
'''Retrieves a token to be used with API requests.
ARCGIS REST API PASSWORD
The portal's URL, user name, and password are provided as arguments.ĭef generateToken(username, password, portalUrl): The following Python function requests a token. You must include this token in any web service requests you make to the portal. In either case, the portal returns to you a token, which is a special string of characters that communicates to the portal you have been authenticated to perform certain types of actions. If your portal is configured with enterprise logins and web tier authentication, it is recommended that you have your scripts bypass the Web Adaptor and use the initial administrator account created after installing Portal for ArcGIS. If your portal is configured to use built-in accounts and token authentication, you'll be able to use your scripts with the same administrative accounts and URLs that you would use from the ArcGIS Portal Directory. However, unlike accessing the portal website or ArcGIS Portal Directory where your browser will transparently handle the authentication process, you must understand how authentication occurs when using scripts to administer your portal. The same concept applies when you write scripts. Whenever you administer the portal through its website or ArcGIS Portal Directory, you need to provide the user name and password of an account that has the appropriate privileges to the portal. The intended web application for portal administration is the Portal for ArcGIS website. This information is extremely valuable when you're attempting to construct your own administrative HTTP requests through Python or another scripting language.Īlthough you can use the ArcGIS Portal Directory interactively to actually perform administrative tasks, it is best used as a learning tool to help you get familiar with the REST API.
ARCGIS REST API FULL
Web developer tools such as Fiddler or Firebug can be useful to see the full body of the request and response. Note the parameters you are required to enter, and examine the URL in your browser's address bar as you make the request to the server. Try using the ArcGIS Portal Directory to perform an administrative task. You can then formulate these requests and send them over HTTP using a scripting language of your choice. You can navigate the links in the ArcGIS Portal Directory to learn which URLs and parameters to use in your administrative web service requests. Think of the ArcGIS Portal Directory as a list of Portal for ArcGIS resources exposed through the REST API. The URLs to the applications are formatted as follows: The available tasks vary between the applications, as described in About the ArcGIS Portal Directory. The ArcGIS Portal Directory is conceptually similar to the ArcGIS Server Administrator Directory and Services Directory.
ARCGIS REST API HOW TO
The ArcGIS Portal Directory is available through two web applications and can help you understand how to write administrative scripts for your portal. A simple way to familiarize yourself with the administrative operations available and their required parameters is to use the ArcGIS Portal Directory. To use the ArcGIS REST API, you create an HTTP request for the operation you want to perform and include the required parameters for that operation. Getting started with portal administration using the ArcGIS REST API All you need is an environment where you can make HTTP requests to your portal. While profiling the ArcGIS Rest API we stumbled across a Postman Collection for the API, which reduces friction when on-boarding with the API.
ARCGIS REST API SOFTWARE
It's important to note that using the API does not require any Esri software on the machine from which you run the script. ArcGIS is a complete mapping and analytics platform for developers, with a robust set of APIs for finding an address, get directions, calculate drive time, etc. The examples in this help system use Python. To write scripts that administer Portal for ArcGIS, you need to choose a scripting language that allows you to construct URLs, make HTTP requests, and parse HTTP responses. Even when you use the Portal for ArcGIS website to administer your portal, calls to the API are being made on the back end. Portal for ArcGIS can be administered purely through requests to the ArcGIS REST API.
