I am trying to update metadata (XML file) for ArcGIS online items using the REST API but I am not quite sure how to do that.
It says in the documentation that I should be able to change the metadata on the Add Item and Update Item operations, but not exactly how:
http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r30000009v000000
Here is my try which returns a success but doesn't actually change the metadata.
def update_metadata(user, item, token, metadata):
d = {'metadata': (metadata, open(metadata, 'rb')),
"token" :token,
"f":"json"}
url = 'http://www.arcgis.com/sharing/rest/content/users/{0}/items/{1}/update'.format(user, item)
r = requests.post(url, data = d)
response = json.loads(r.content)
if 'error' in response.keys():
raise Exception(response['message'], response['details'])
return response
Did anyone already successfully updated metadata for ArcGIS online items using the REST API, and if yes how?