<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Access to route and analysis API in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/access-to-route-and-analysis-api/m-p/1007987#M3649</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I’d like to get the drive time between two points in the UK using the REST API, and I'm working in Postman at the moment. I believe this can be done in two ways, but I’m unable to get either of them to work, for different reasons. I have successfully generated a token in an earlier piece of work. This token works fine for other calls, such as GetTravelMode, the portal/self call, and a call to a feature layer using a call in the form &lt;A href="https://services1.arcgis.com/.../arcgis/rest/services/.../FeatureServer/extractChanges" target="_blank"&gt;https://services1.arcgis.com/.../arcgis/rest/services/.../FeatureServer/extractChanges&lt;/A&gt;.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;So, onto the calls I’ve tried:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;The first is by using the &lt;A href="https://protect-eu.mimecast.com/s/3OaHCOY3Yu28p1xF5svTP" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve&lt;/A&gt; &amp;nbsp;endpoint.&lt;BR /&gt;My call is:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&amp;amp;token=##OUR_TOKEN##&amp;amp;stops=-117.1957,34.0564" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&amp;amp;token=##OUR_TOKEN##&amp;amp;stops=-117.1957,34.0564&lt;/A&gt;; -117.184,34.0546&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;But I get this response in Postman:&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"error":&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"code":&amp;nbsp;403,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"subcode":&amp;nbsp;2,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message":&amp;nbsp;"User&amp;nbsp;does&amp;nbsp;not&amp;nbsp;have&amp;nbsp;permissions&amp;nbsp;to&amp;nbsp;access&amp;nbsp;'world/route.mapserver'.",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"details":&amp;nbsp;[]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;The second method I’ve tried is using the connectOriginsToDestinations endpoint&amp;nbsp;http://&amp;lt;analysis url&amp;gt;/connectOriginsToDestinations/submitJob&lt;BR /&gt;With this, I’m not so clear on the URL I need. I’ve tried this URL in a POST call:&lt;BR /&gt;&lt;A href="https://protect-eu.mimecast.com/s/yz1yCQW9WcNQkvPIQxrut" target="_blank"&gt;https://analysis.arcgis.com/arcgis/rest/services/connectOriginsToDestinations/submitJob&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;I’ve supplied parameters of:&lt;BR /&gt;f=json&lt;BR /&gt;token=our token,&lt;BR /&gt;originsLayer = a layer definition object {"layerDefinition": {"geometryType": "esriGeometryPoint","fields": [{"name": "Id","type": "esriFieldTypeOID","alias": "Id"},{"name": "Name","type": "esriFieldTypeString","alias": "Name"}]},"featureSet": {"geometryType": "esriGeometryPoint","spatialReference": {"wkid": 4326},"features": [{"geometry": {"x": -100.65,"y": 33.69},"attributes": {"Id": 67,"Name": "Feature 2"}}]}},&lt;BR /&gt;destinationsLayer = a layer definition object {"layerDefinition": {"geometryType": "esriGeometryPoint","fields": [{"name": "Id","type": "esriFieldTypeOID","alias": "Id"},{"name": "Name","type": "esriFieldTypeString","alias": "Name"}]},"featureSet": {"geometryType": "esriGeometryPoint","spatialReference": {"wkid": 4326},"features": [{"geometry": {"x": -104.44,"y": 34.83},"attributes": {"Id": 43,"Name": "Feature 1"}}]}},&lt;BR /&gt;measurementType = a travel mode object that I successfully obtained from the &lt;A href="https://protect-eu.mimecast.com/s/RIgaCR636Cg6v4WuXraFU" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Utilities/GPServer/GetTravelModes/execute&lt;/A&gt; endpoint.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;For this call I get back this error:&lt;BR /&gt;{"error":{"code":498,"message":"Invalid token.","details":[]}}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;However I know the token is OK, as I can refresh it and use it for other calls without any error.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;So I’m after advice on which of these call is the most sensible to use to get simple drive time information between two points (I don’t even need the route – just the time), and how to make the call work. I know very little about ArcGIS itself, having been asked to connect another one of our internal systems to the API in order to get this information. I have asked our administrator to check that I have the correct permissions, but he's checked everything he can think of without any success.&lt;BR /&gt;&lt;BR /&gt;Any advice would be much appreciated.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Jason.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 08:26:14 GMT</pubDate>
    <dc:creator>JasonWestley</dc:creator>
    <dc:date>2020-12-09T08:26:14Z</dc:date>
    <item>
      <title>Access to route and analysis API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/access-to-route-and-analysis-api/m-p/1007987#M3649</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I’d like to get the drive time between two points in the UK using the REST API, and I'm working in Postman at the moment. I believe this can be done in two ways, but I’m unable to get either of them to work, for different reasons. I have successfully generated a token in an earlier piece of work. This token works fine for other calls, such as GetTravelMode, the portal/self call, and a call to a feature layer using a call in the form &lt;A href="https://services1.arcgis.com/.../arcgis/rest/services/.../FeatureServer/extractChanges" target="_blank"&gt;https://services1.arcgis.com/.../arcgis/rest/services/.../FeatureServer/extractChanges&lt;/A&gt;.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;So, onto the calls I’ve tried:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;The first is by using the &lt;A href="https://protect-eu.mimecast.com/s/3OaHCOY3Yu28p1xF5svTP" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve&lt;/A&gt; &amp;nbsp;endpoint.&lt;BR /&gt;My call is:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&amp;amp;token=##OUR_TOKEN##&amp;amp;stops=-117.1957,34.0564" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&amp;amp;token=##OUR_TOKEN##&amp;amp;stops=-117.1957,34.0564&lt;/A&gt;; -117.184,34.0546&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;But I get this response in Postman:&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"error":&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"code":&amp;nbsp;403,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"subcode":&amp;nbsp;2,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message":&amp;nbsp;"User&amp;nbsp;does&amp;nbsp;not&amp;nbsp;have&amp;nbsp;permissions&amp;nbsp;to&amp;nbsp;access&amp;nbsp;'world/route.mapserver'.",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"details":&amp;nbsp;[]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;The second method I’ve tried is using the connectOriginsToDestinations endpoint&amp;nbsp;http://&amp;lt;analysis url&amp;gt;/connectOriginsToDestinations/submitJob&lt;BR /&gt;With this, I’m not so clear on the URL I need. I’ve tried this URL in a POST call:&lt;BR /&gt;&lt;A href="https://protect-eu.mimecast.com/s/yz1yCQW9WcNQkvPIQxrut" target="_blank"&gt;https://analysis.arcgis.com/arcgis/rest/services/connectOriginsToDestinations/submitJob&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;I’ve supplied parameters of:&lt;BR /&gt;f=json&lt;BR /&gt;token=our token,&lt;BR /&gt;originsLayer = a layer definition object {"layerDefinition": {"geometryType": "esriGeometryPoint","fields": [{"name": "Id","type": "esriFieldTypeOID","alias": "Id"},{"name": "Name","type": "esriFieldTypeString","alias": "Name"}]},"featureSet": {"geometryType": "esriGeometryPoint","spatialReference": {"wkid": 4326},"features": [{"geometry": {"x": -100.65,"y": 33.69},"attributes": {"Id": 67,"Name": "Feature 2"}}]}},&lt;BR /&gt;destinationsLayer = a layer definition object {"layerDefinition": {"geometryType": "esriGeometryPoint","fields": [{"name": "Id","type": "esriFieldTypeOID","alias": "Id"},{"name": "Name","type": "esriFieldTypeString","alias": "Name"}]},"featureSet": {"geometryType": "esriGeometryPoint","spatialReference": {"wkid": 4326},"features": [{"geometry": {"x": -104.44,"y": 34.83},"attributes": {"Id": 43,"Name": "Feature 1"}}]}},&lt;BR /&gt;measurementType = a travel mode object that I successfully obtained from the &lt;A href="https://protect-eu.mimecast.com/s/RIgaCR636Cg6v4WuXraFU" target="_blank"&gt;https://route.arcgis.com/arcgis/rest/services/World/Utilities/GPServer/GetTravelModes/execute&lt;/A&gt; endpoint.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;For this call I get back this error:&lt;BR /&gt;{"error":{"code":498,"message":"Invalid token.","details":[]}}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;However I know the token is OK, as I can refresh it and use it for other calls without any error.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;So I’m after advice on which of these call is the most sensible to use to get simple drive time information between two points (I don’t even need the route – just the time), and how to make the call work. I know very little about ArcGIS itself, having been asked to connect another one of our internal systems to the API in order to get this information. I have asked our administrator to check that I have the correct permissions, but he's checked everything he can think of without any success.&lt;BR /&gt;&lt;BR /&gt;Any advice would be much appreciated.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Jason.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 08:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/access-to-route-and-analysis-api/m-p/1007987#M3649</guid>
      <dc:creator>JasonWestley</dc:creator>
      <dc:date>2020-12-09T08:26:14Z</dc:date>
    </item>
  </channel>
</rss>

