I am trying to add a feature to the Dataset via Mapbox API using Python. I'm following this instruction https://docs.mapbox.com/api/maps/#update-a-dataset but keep getting this error:
{'message': 'Provide a single Feature to insert'}
The code looks like this:
rs = []
dictionary = {
"id":1,
"type":"Feature",
"properties":{},
"geometry":{"coordinates":[-83.750246, 42.269375],"type":"Point"}}
url = "https://api.mapbox.com/datasets/v1/voratima/"+dataset+"/features/1?access_token="+access_token
rs.append(grequests.put(url, data=dictionary, hooks = {'response' : do_something}))
grequests.map(rs, exception_handler=exception_handler)
I've tried the following but none of them work:
- using
requestsinstead ofgrequests - wrapping the dictionary with
json.dumps() - changing the put parameter from
data=dictionarytojson=dictionary - Making sure the
idfor both data and URL are set to1.
Postman of the exact same request does not have the error. What am I missing?
Given a dataset with dataset ID
datasetexists, your request body looks ok. Please add the headerAlso can you check if you meet these specs: