Hi,
I am using the Urban API with python. I would like to get a list of all UrbanDesignDatabases within a UrbanModel that have an upgrade available.
I am trying to build the query that filter the design databases where the upgrade_status field of the upgrade_info is "UpgradeAvailable". I am following the sgqlc documentation: https://sgqlc.readthedocs.io/en/latest/sgqlc.operation.html#sgqlc.operation.Operation
endpoint = HTTPEndpoint(endpoint_url, {"Authorization": "Bearer " + token})
op = Operation(schema.Query, limit=int, offset=int)
design_db = op.urban_model(urban_model_id=urban_model_id).urban_design_databases(limit=Variable("limit"), offset=Variable("offset"))
design_db.title()
design_db.upgrade_info(upgrade_status="UpgradeAvailable")
The last line returns KeyError: 'upgrade_status'
I have tried using a filter like this, but I have KeyError: 'filter'
design_db.upgrade_info(filter={"upgrade_status": "UpgradeAvailable"})
Is there a way to build queries with filters or do I have to query all the design databases and do the filtering on the client side?
Thank you
Solved! Go to Solution.
Hi Maxime,
thank you for your question. Unfortunately, there is no filtering implemented on the upgrade_info field in the Urban API.
To explore filters available for different operations and fields, you can use the docs tab in the graphiql interface, available at https://urban-api.arcgis.com/graphql.
For example, the following filters (in purple) are available for the UrbanDesignDatabases query:
Sometimes, filters are also implemented on the field level, for example you can filter thumbnail field by the size.
However, if you search for the upgradeInfo field, you can see that no filters are available.
For your current issue, I would suggest filtering the returned query response and finding the GlobalIds of the urbanDesignDatabases that require the upgrade.
Please let me know if you have any further questions.
I have modified my first post as it was containing erroneous code sample
Hi Maxime,
thank you for your question. Unfortunately, there is no filtering implemented on the upgrade_info field in the Urban API.
To explore filters available for different operations and fields, you can use the docs tab in the graphiql interface, available at https://urban-api.arcgis.com/graphql.
For example, the following filters (in purple) are available for the UrbanDesignDatabases query:
Sometimes, filters are also implemented on the field level, for example you can filter thumbnail field by the size.
However, if you search for the upgradeInfo field, you can see that no filters are available.
For your current issue, I would suggest filtering the returned query response and finding the GlobalIds of the urbanDesignDatabases that require the upgrade.
Please let me know if you have any further questions.
Thank you very much for the info, I was not aware the filters was listed like that in the documentation.
That will help a lot for future usages.
Have a nice day