I am trying to call the Origin Destination Cost Matrix service using a REST API.
I using the following URL and performing a GET call:
https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/submitJob?origins="{\"spatialReference\":{\"wkid\":4326,\"latestWkid\":4326},\"features\":[{\"geometry\":{\"x\":-118.4676794,\"y\":34.0695674},\"attributes\":{\"name\":\"id1\"}},{\"geometry\":{\"x\":-118.4808791,\"y\":33.9974089},\"attributes\":{\"name\":\"id2\"}}]}"&destinations="{\"spatialReference\":{\"wkid\":4326,\"latestWkid\":4326},\"features\":[{\"geometry\":{\"x\":-118.4676794,\"y\":34.0695674},\"attributes\":{\"name\":\"id1\"}},{\"geometry\":{\"x\":-118.4808791,\"y\":33.9974089},\"attributes\":{\"name\":\"id2\"}}]}"&token=<MY-TOKEN>&f=pjson
However, I keep getting a HTTP 400 error. Can somebody provide me with an example of how to use this service?
UPDATE:
I actually even tried the URL provided in the documentation (with the right token):
https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/submitJob?origins={"features":[{"geometry":{"y":51.5254,"x":-0.1891},"attributes":{"Name":"Origin 1","TargetDestinationCount":2,"Cutoff":120,"CurbApproach":0}},{"geometry":{"y":51.5353,"x":-0.1744},"attributes":{"Name":"Origin 2","TargetDestinationCount":3,"Cutoff":90,"CurbApproach":0}}]}&demand_points={"features":[{"geometry":{"y":51.5354,"x":-0.1991},"attributes":{"Name":"Destination 1","CurbApproach":0}},{"geometry":{"y":51.5458,"x":-0.1844},"attributes":{"Name":"Destination 2","CurbApproach":0}}]}&token=<MY-TOKEN>&f=pjson
and it still doesn't work. The documentation seems to be outdated. Perhaps some ArcGis developer can provide some insight here?
Furthermore, the documentation lists `destinations` as a required parameter but the example has `demand_points`, and switching it still doesn't work!