The Utilities service contains operations that provide auxiliary information for working with routing services available with ArcGIS Online. The Utilities service contains two operations, Get
and Get
. The Get
operation returns a list of travel modes configured for your organization that can be used with routing services. A travel mode represents a means of transportation, such as driving or walking. Travel modes essentially templates consisting of a long list of travel settings.
The Get
operation is meant to be used by different applications to display the name and, optionally, the description of the available travel modes in their user experience. An administrator of your organization can configure travel modes to change the properties of the default travel modes provided by ArcGIS Online, add new travel modes that better reflect your organization’s workflows, or remove travel modes that are not suitable for your organization’s workflows.
Required parameters
The Get
operation takes the token
and f
parameters, which are both required.
token
An access token with the required privileges.
- ArcGIS Location Platform: premium:user:networkanalysis:routing or premium:user:networkanalysis:optimizedrouting
- ArcGIS Online: premium:user:networkanalysis
token=<ACCESS_TOKEN>
To use HTTP headers instead of the token
parameter, set the following:
GET <SERVICE_REQUEST> HTTP/1.1
Host: <SERVICE_DOMAIN>
X-Esri-Authorization: Bearer <ACCESS_TOKEN>
Learn more about access tokens and privileges in the Security and authentication developer guide.
Response details
The request to Get
returns a JSON response that contains any warning messages from the service execution as well as an array of results. Each result in this array contains the value for the output parameters, supported
and default
. If the request fails to execute, the response only contains the error
property that contains the error messages.
For a list of error codes and details, go to Direct request error codes
You can make a request to the Get
operation from the Utilities service using the URL of the following form
POST https://route-api.arcgis.com/arcgis/rest/services/World/Utilities/GPServer/GetTravelModes/execute? HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<ACCESS_TOKEN>
&f=json
Upon successful completion, the service returns a list of supported travel modes and the default travel mode as the output parameters described below:
supportedTravelModes
Use this parameter to a get a list of travel modes supported by your organization.
The following provides a description of fields that are returned for each travel mode:
Object
—A unique identifier for the travel mode. This identifier is automatically generated by the service.ID Name
—The name of the travel mode. This field can include the localized travel mode name and cannot be used to uniquely identify a travel mode based on its name. Use theAlt
field for this instead.Name Travel
—A unique identifier for the travel mode. This identifier is created every time a new travel mode is added but remains the same for existing travel modes.Mode Id Travel
—The travel mode setting for a given travel mode. The value is a string representing a JSON object. When calling the routing services, you must convert this string into a JSON object using your API.Mode Alt
—The name of the travel mode that does not change based on the profile language of the signed in user. This value can be used to uniquely identify a travel mode based on its name, unlike theName Name
field.
The following shows an example of the supported
parameter.
Example:
{
"paramName": "supportedTravelModes",
"dataType": "GPRecordSet",
"value": {
"displayFieldName": "",
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Travel Mode Name",
"length": 255
},
{
"name": "TravelModeId",
"type": "esriFieldTypeString",
defaultTravelMode
Use this parameter to get the default travel mode to be used by the user interface of your application. The value
property returns the travel mode ID that corresponds to the Travel
property of the attributes
objects returned by the supported
output parameter.
The following shows an example of the default
parameter:
Example:
{
"paramName": "defaultTravelMode",
"dataType": "GPString",
"value": "FEgifRtFndKNcJMJ"
}
Examples
Get a list of supported travel modes when the user profile language is English
In this example, you will get a list of all the travel modes that are supported in your ArcGIS Online organization. The language of the signed in user is English. The Name
and Alt
fields for travel modes have identical values.
POST https://route-api.arcgis.com/arcgis/rest/services/World/Utilities/GPServer/GetTravelModes/execute? HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<ACCESS_TOKEN>
&f=pjson
Get a list of supported travel modes when the user profile language is Spanish
In this example, you will get a list of all the travel modes that are supported in your ArcGIS Online organization. The language of the signed in user is Spanish. The Name
field provides the travel mode name in Spanish, and the Alt
field provides the travel mode name in English. Regardless of the user profile language, the Alt
field always provides the travel mode name in English.
POST https://route-api.arcgis.com/arcgis/rest/services/World/Utilities/GPServer/GetTravelModes/execute? HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<ACCESS_TOKEN>
&f=pjson