Select to view content in your preferred language

Append REST API endpoint rejects request even though it's enabled

1471
6
Jump to solution
03-15-2022 04:09 PM
ewagstaff
New Contributor III

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?

0 Kudos
1 Solution

Accepted Solutions
ewagstaff
New Contributor III

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. 

View solution in original post

6 Replies
DavidPike
MVP Frequent Contributor

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'

0 Kudos
ewagstaff
New Contributor III

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

  • A feature service that supports the append API exposes the supportsAppend metadata property. When the supportsAppend property is absent or is false, the owner of the feature service cannot use the append API. Also the Append capability cannot be added to a feature service if the supportsAppend is true. See Append (Feature Service) or Append (Feature Service/Layer) for more details.

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.

0 Kudos
ewagstaff
New Contributor III

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. 

B_Brooks
New Contributor III

Can you show the basic code for the generateToken request that made the difference? Any additional guidance would be helpful.

0 Kudos
ewagstaff
New Contributor III

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
B_Brooks
New Contributor III

Very helpful. That's what I needed. 🙂

0 Kudos