Learn how to sign in and access your portal programmatically using an access token.
Prerequisites
You need an ArcGIS Location Platform, ArcGIS Online, or ArcGIS Enterprise account to use your portal.
Steps
Get the portal URL
To access a portal, you need an ArcGIS account which is associated with an organization that allows you to store and manage your content.
- In a web browser, sign in to your portal with your ArcGIS account.
- Identify the portal URL from the navigation bar. The base URL should be one of the following:
- ArcGIS Location Platform:
https
://www.arcgis.com/sharing/rest - ArcGIS Online:
https
://www.arcgis.com/sharing/rest - ArcGIS Enterprise:
https
://{machine.domain.com}/{webadaptor}/rest
- ArcGIS Location Platform:
- Copy the URL and store it in a safe location. You will need it in a later step.
Get an access token
To perform the portal service operation in this tutorial, you need an access token from OAuth 2.0 credentials. It is the only supported form of authentication. The use of API keys is not supported.
-
Go to the Create OAuth credentials for user authentication tutorial to get a set of OAuth 2.0 credentials.
-
Get an access token from the OAuth 2.0 credentials.
-
Copy the access token to your clipboard when prompted.
Set up environment
- In a different window, launch Postman and create a blank request.
Perform a self
call
- Set the request type to
POST
. - Paste your portal URL and append
/self
at the end. - Set the
f
parameter tojson
in the parameter list. - Set the
token
parameter to your access token in the parameter list. - Run the request.
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded
&f=json
&token=<YOUR_ACCESS_TOKEN>
View the results
The output of your self
call should look something like this, but with information about your portal:
{
"2DStylesGroupQuery": "title:\"Esri 2D Styles\" AND owner:esri_en",
"3DBasemapGalleryGroupQuery": "title:\"ArcGIS Online 3D Basemaps\" AND owner:esri_en",
"access": "public",
"allSSL": true,
"allowedRedirectUris": [],
"analysisLayersGroupQuery": "title:\"Living Atlas Analysis Layers\" AND owner:esri",
"authorizedCrossOriginDomains": [],
"availableCredits": 5.0018196E7,
"basemapGalleryGroupQuery": "title:\"United States Basemaps\" AND owner:Esri_cy_US",
"canListApps": false,
"canListConsultingServices": false,
What's next
Copy a hosted layer item
Use the portal service to copy a hosted layer item in your portal.
Set sharing level for an item
Use the portal service to set the sharing level for an item in your portal.
Create a new group and add members
Use the portal service to create a new group and add members in your portal.