GetTravelModes operation

The Utilities service contains operations that provide auxiliary information for working with routing services available with ArcGIS Online. The Utilities service contains two operations, GetTravelModes and GetToolInfo. The GetTravelModes 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.

Required parameters

The GetTravelModes operation takes the token and f parameters, which are both required.

f

The response format.

Use dark colors for code blocksCopy
1
f=json

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
Use dark colors for code blocksCopy
1
token=<ACCESS_TOKEN>

Learn more about access tokens and privileges in the Security and authentication developer guide.

Response details

The request to GetTravelModes 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, supportedTravelModes and defaultTravelMode . 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 GetTravelModes operation from the Utilities service using the URL of the following form

POST
Use dark colors for code blocksCopy
1
2
3
4
5
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:

  • ObjectID—A unique identifier for the travel mode. This identifier is automatically generated by the service.
  • 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 the AltName field for this instead.
  • TravelModeId—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.
  • TravelMode—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.
  • AltName—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 the Name field.

The following shows an example of the supportedTravelModes parameter.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  "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",
Expand

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 TravelModeId property of the attributes objects returned by the supportedTravelModes output parameter.

The following shows an example of the defaultTravelMode parameter:

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
{
  "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 AltName fields for travel modes have identical values.

Use dark colors for code blocksCopy
1
2
3
4
5
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 AltName field provides the travel mode name in English. Regardless of the user profile language, the AltName field always provides the travel mode name in English.

Use dark colors for code blocksCopy
1
2
3
4
5
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

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.