question

PerFahlen-0324 avatar image
0 Votes"
PerFahlen-0324 asked asergaz edited

Post Route Directions - departAt

Having problem to understand the departAt parameter, If I want to set the UTC-time offset to for example New York (-4) it works as expected

Posting a Curl call for the request works as expected.



 curl --location --request POST 'https://atlas.microsoft.com/route/directions/json?api-version=1.0&query=62.40467485319353,16.69276598618868:62.47793784549315,17.3332779176645&vehicleMaxSpeed=70&minDeviationDistance=100&minDeviationTime=0&travelMode=truck&traffic=True&computeTravelTimeFor=all&subscription-key=<key>&departAt=2021-09-20T10:40:46-04:00' \
 --header 'content: application/json;utf-8' \
 --header 'Content-Type: application/json' \
 --data-raw '{
     "supportingPoints": {
         "type": "GeometryCollection",
         "geometries": [{
             "type": "Point",
             "coordinates": [16.692766, 62.404675]
         },{
             "type": "Point",
             "coordinates": [17.334278, 62.479572]
         }]
     }
 }'

However, If want to set departAt to Stockholm (+2) it returns 400 with the message ("departAt value must be in a valid date time format")

The only different in the below request is the time offset changed from -04:00 to +02:00.

 curl --location --request POST 'https://atlas.microsoft.com/route/directions/json?api-version=1.0&query=62.40467485319353,16.69276598618868:62.47793784549315,17.3332779176645&vehicleMaxSpeed=70&minDeviationDistance=100&minDeviationTime=0&travelMode=truck&traffic=True&computeTravelTimeFor=all&subscription-key=<key>&departAt=2021-09-20T10:40:46+02:00' \
 --header 'content: application/json;utf-8' \
 --header 'Content-Type: application/json' \
 --data-raw '{
     "supportingPoints": {
         "type": "GeometryCollection",
         "geometries": [{
             "type": "Point",
             "coordinates": [16.692766, 62.404675]
         },{
             "type": "Point",
             "coordinates": [17.334278, 62.479572]
         }]
     }
 }'

While at this property in the request, the documentation is a bit fuzzy

"The date and time of departure from the origin point. Departure times apart from now must be specified as a dateTime. When a time zone offset is not specified, it will be assumed to be that of the origin point. The departAt value must be in the future in the date-time format (1996-12-19T16:39:57-08:00)."

I assumed the origin point is the actual coordinate, or is it the origin caller time in some way?

azure-maps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

asergaz avatar image
1 Vote"
asergaz answered asergaz edited

Hi @PerFahlen-0324 can you try encoding the + to %2b ?

Thanks.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @asergaz. Of course :) URL-encoding

0 Votes 0 ·

Did it work? :)

0 Votes 0 ·