Select to view content in your preferred language

updateDefinition - rebuilding spatial indexes - error 400 Cannot perform query Invalid query parameters

99
0
Friday
Labels (1)
ar99
by
New Contributor

https://developers.arcgis.com/rest/services-reference/online/update-definition-feature-layer-.htm

Am using the updateDefinition API to rebuild spatial indexes of layers in an AGOL Feature Service from python.

For some Feature Services the code below returns: {"success":true}
But other Feature Services, using the same code below, return an error:
{"error":{"code":400,"message":"","details":["Cannot perform query. Invalid query parameters."]}}

Does a Feature Service need specific settings to allow an updateDefinition?

Thanks

 

import json
import requests

updateDefinition_url_format = """{featureservice_url}/{layerid}/updateDefinition?token={token}&updateDefinition={{"indexes":[{{"name":"{spatialindexname}","fields":"Shape"}}]}}&f=json"""

url = updateDefinition_url_format.format(
    featureservice_url=featureservice_url,
    layerid=layerid,
    token=token,
    spatialindexname=spatialindexname)
response = requests.post(url = url)

print(response.status_code, response.text)

 

Note: featureservice_url is the Feature Service URL found on the Overview page:
eg: https://services9.arcgis.com/Ukx32kQ0G9qTC0D/arcgis/rest/services/<featureservicename>/FeatureServer

0 Kudos
0 Replies