Hi all,
Making a request to the service URL confirms:
"supportsAppend": true
However when calling the /append endpoint using an OAuth token (from an app made by an admin account), I get this response:
{
"error": {
"code": 405,
"message": "Unable to append data.",
"details": [
"Append is not enabled."
]
}
}
Sync and tracking are both disabled on the layer, as required. The /addFeatures endpoint works fine. Not sure what else to try. Does anyone know why I can't append?
Solved! Go to Solution.
For anyone encountering this issue later on, here's the solution:
Even though the response says "Append is not enabled", the problem has nothing to do with the layer. Apparently the OAuth token I generated that lets me do all kinds of operations within the organization was not the right token to use for this particular operation. I had to generate a special token just for this using the /generateToken endpoint but using my organization's domain instead of the https://www.arcgis.com domain.
I figured this out by monitoring the network requests of the actual append operation that you can do through the ArcGIS Online portal.
I think supportsAppend only indicates that append is allowed to be enabled Update Definition (Feature Service)—ArcGIS REST APIs | ArcGIS Developers
I would guess this means adding append to 'capabilities'
Thanks for the idea. I was looking to see if "Append" is a valid addition to capabilities, and found this confusing paragraph in the docs here: https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
So... if supportsAppend is false, you can't append, but if supportsAppend is true (like it is for me), then the Append capability cannot be added. The only way that makes sense in my head is if that means I can ALREADY use the /append endpoint, but it does not seem to be working.
For anyone encountering this issue later on, here's the solution:
Even though the response says "Append is not enabled", the problem has nothing to do with the layer. Apparently the OAuth token I generated that lets me do all kinds of operations within the organization was not the right token to use for this particular operation. I had to generate a special token just for this using the /generateToken endpoint but using my organization's domain instead of the https://www.arcgis.com domain.
I figured this out by monitoring the network requests of the actual append operation that you can do through the ArcGIS Online portal.
Can you show the basic code for the generateToken request that made the difference? Any additional guidance would be helpful.
Sure, this is the request URL that generated the token that triggered the "Append is not enabled" error:
curl --request POST \
--url 'https://www.arcgis.com/sharing/rest/generateToken?f=json&client=requestip&=' \
--header 'Content-Type: multipart/form-data; boundary=---011000010111000001101001' \
--form password=SECRET_PASSWORD \
--form username=SECRET_USER
And this is the one that request that generated a token that worked for us:
curl --request POST \
--url 'https://OUR_ORGANIZATION.maps.arcgis.com/sharing/rest/generateToken?f=json&grant_type=client_credentials' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data username=SECRET_USER \
--data password=SECRET_PASSWORD \
--data referer=clientip
Very helpful. That's what I needed. 🙂