esri-es/ArcGIS-REST-API

Creating a new item gives me a permission error

pilarArr opened this issue · 3 comments

I'm trying to create a new webmap item and I get this error.

{"error":{"code":403,"messageCode":"GWM_0003","message":"You do not have permissions to access this resource or perform this operation.","details":[]}}

POSTMAN Request

I've deleted some of the params to leave the bare minimum and the JSON for the webmap I'm trying to add is this:

{
    "operationalLayers": [],
    "baseMap": {
        "baseMapLayers": [
            {
                "id": "defaultBasemap",
                "layerType": "ArcGISTiledMapServiceLayer",
                "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",
                "visibility": true,
                "opacity": 1,
                "title": "Topographic"
            }
        ],
        "title": "Topographic"
    },
    "spatialReference": {
        "wkid": 102100,
        "latestWkid": 3857
    },
    "authoringApp": "WebMapViewer",
    "authoringAppVersion": "5.4",
    "version": "2.11"
}

Hi Pilar, I have just checked the documentation and you are right, using the App login have certain limitations:

App login comes with several built-in limitations:
...

  • Applications cannot create, update, share, modify, or delete items (layers, files, services, maps) in ArcGIS Online or ArcGIS Enterprise.

I wasn't aware of. Knowing that I guess the only way to get the token using the username and password, right @gavinr ?

mmm I have just tried using the server side approach as @anmaro13 explained here and it worked so I guess the problem is related with the way of generating the token. How are you doing it?

Yes, I was using the wrong access token, sorry I forgot to update this issue

I updated my post in geodevelopers but I forgot this one :(
https://community.esri.com/thread/212331-create-simple-web-map-via-api-rest