Deleting items -- JS api

3463
2
Jump to solution
10-31-2014 03:44 PM
by Anonymous User
Not applicable

I'm using the esri/request module. I can get items just fine, but I'm not able to delete items as I should be able to.

I am using the url format shown in the ArcGIS REST API, like so: http://www.arcgis.com/sharing/rest/content/users/username/items/itemid/delete ,

but the error I am getting is "invalid token <".

I then tried putting a "?f=json" on the end of the url, just to find out more. This time, the error I got back was "405 method not allowed".

Is there a way to delete content using the esri.request module? I am authenticated with OAuth 2.0 and the esri/identityManager, so that shouldn't be a problem (and I can see my private items using the get request with the esri/request module).

0 Kudos
1 Solution

Accepted Solutions
OwenEarley
Occasional Contributor III

Are you sending the JSON data via a POST request?

All other HTTP methods should result in the 405 error. See this page in the ArcGIS REST API

View solution in original post

0 Kudos
2 Replies
OwenEarley
Occasional Contributor III

Are you sending the JSON data via a POST request?

All other HTTP methods should result in the 405 error. See this page in the ArcGIS REST API

0 Kudos
StevenKitterman1
New Contributor II

I was able to get it to work after all. It turns out that I had to pass the token in the content attribute for the request, not as part of the url.

0 Kudos