diff --git a/ezoff/locations.py b/ezoff/locations.py index 7398364..0ce4253 100644 --- a/ezoff/locations.py +++ b/ezoff/locations.py @@ -303,10 +303,20 @@ def deactivate_location(location_num: int) -> dict: @Decorators.check_env_vars def update_location(location_num: int, location: dict) -> dict: """ - Updates a location + Updates a location. + Note: The location's parent ID (location[parent_id]) is a required field for this call, + because EZOffice will wipe out whatever is currently in that field + if you don't include it. No idea why. If you're not changing the parent + location of the location, you just use the current parent ID. The documentation + also suggests that location[name] is a required field, but that doesn't appear + to be the case. Not sure if documentation is wrong or I'm misunderstanding what + they're saying. https://ezo.io/ezofficeinventory/developers/#api-update-location """ + if "location[parent_id]" not in location: + raise ValueError("'location[parent_id]' is a required key") + # Remove any keys that are not valid valid_keys = [ "location[parent_id]", diff --git a/setup.py b/setup.py index 9b4f2f4..a4fbd83 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="ezoff", - version="0.1.3", + version="0.1.4", description="Python package that acts as a wrapper for the EZOffice API.", long_description=long_description, long_description_content_type="text/markdown",