none
Async REST call to Optimize Multiple Itineraries is giving an error when given more than 20 itinerary items RRS feed

  • Question

  • The docs clearly states that there is a 20 itinerary items limitation for the sync call and 100 for the async.

    I'm using the async call and it fails with the messages stating that the limitation is 20.

    I hope I'm doing something wrong.

    Tuesday, May 12, 2020 9:00 PM

Answers

  • Hi Stephane,

    Monday is a holiday in the US so the team is currently out of the office.  Hopefully they can take a look at this in the next week.

    UPDATE: The answer is that the Basic Key you are using is limited to 2 Agents and 20 items so the behavior you are seeing is expected.  The team will be fixing the documentation to reflect more Agents and Items for Enterprise Keys and the numbers are higher than those stated on the site now. This is due to the complexity of the call in the background  To purchase an Enterprise Key you can reach out to MapLic@Microsoft.Com if you are in the Americas or MapEMEA@Microsoft.com if you are in the rest of the world.

    Sincerely,

    IoTGirl


    Monday, May 25, 2020 5:10 PM
    Owner

All replies

  • Hi Stephane,

    My guess would be that you are calling SYNC rather than ASYNC.

    Sincerely,

    IoTGirl

    Tuesday, May 12, 2020 11:31 PM
    Owner
  • Nope... I'm calling the async function:

     

    This is the URL I'm calling:

    var url = "https://dev.virtualearth.net/REST/V1/Routes/OptimizeItineraryAsync?key=" + bingKey;

    With this content as POST data:

     {"agents":[{"name":"Yuan","shifts":[{"startTime":"2020-05-14T08:00:00","endTime":"2020-05-14T13:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]}],"itineraryItems":[{"name":3,"location":{"latitude":32.759846,"longitude":34.976456},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":4,"location":{"latitude":32.7580562,"longitude":34.97382},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":5,"location":{"latitude":32.8158068,"longitude":34.9644042},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":6,"location":{"latitude":32.8126147,"longitude":34.9670024},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":7,"location":{"latitude":32.8073497,"longitude":34.9767602},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":8,"location":{"latitude":32.8084959,"longitude":34.9802291},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":9,"location":{"latitude":32.8096812,"longitude":34.9775619},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":10,"location":{"latitude":32.8040826,"longitude":34.9776968},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":11,"location":{"latitude":32.8043399,"longitude":34.9789342},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":12,"location":{"latitude":32.8016124,"longitude":34.9792118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":13,"location":{"latitude":32.80149730000001,"longitude":34.976059},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":14,"location":{"latitude":32.8003985,"longitude":34.9822105},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":15,"location":{"latitude":32.7988096,"longitude":34.9752847},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":16,"location":{"latitude":32.7951851,"longitude":34.9756281},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":17,"location":{"latitude":32.7971578,"longitude":34.9886685},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":18,"location":{"latitude":32.7997621,"longitude":34.985468},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":19,"location":{"latitude":32.8082998,"longitude":34.9879481},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":20,"location":{"latitude":32.8017594,"longitude":34.99886050000001},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":21,"location":{"latitude":32.804539,"longitude":34.989972},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":22,"location":{"latitude":32.8230697,"longitude":34.9719067},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":23,"location":{"latitude":32.8200018,"longitude":34.9678621},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"},{"name":24,"location":{"latitude":32.8207458,"longitude":34.9867118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T08:00:00","closingTime":"2020-05-14T13:00:00"}]}

    And this is the reply:

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2020 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","errorDetails":["One or more parameters are not valid.",": Invalid number of itinerary items, maximum number of items to be scheduled is 20"],"resourceSets":[],"statusCode":400,"statusDescription":"Bad Request","traceId":"c2ceedbe1cf848fda692cd5b453474da|HK00000BDD|0.0.0.0"}

    I would really appreciate if you could let me know what I'm doing wrong.

    Thanks!



    Saturday, May 16, 2020 7:55 AM
  • Hi Stephane,

    You seem to only have one agent. Have you tried the demo to get an idea of how the API works for agents? https://www.microsoft.com/en-us/maps/multi-itinerary-optimization/multi-itinerary-optimization-api-demo

    Sincerely,

    IoTGirl

    Sunday, May 17, 2020 7:27 PM
    Owner
  • I'm trying to optimize the route of one agent with 22-25 delivery points and it fails after 20.

    Later I would want to try to call with multiple agents, but right now I only need 1

    Monday, May 18, 2020 10:43 AM
  • Even tried with 5 drivers:

    {"agents":[{"name":"Driver1","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver2","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver3","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver4","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver5","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]}],"itineraryItems":[{"name":3,"location":{"latitude":32.7580562,"longitude":34.97382},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":4,"location":{"latitude":32.759846,"longitude":34.976456},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":5,"location":{"latitude":32.8158068,"longitude":34.9644042},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":6,"location":{"latitude":32.8126147,"longitude":34.9670024},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":7,"location":{"latitude":32.8073497,"longitude":34.9767602},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":8,"location":{"latitude":32.8084959,"longitude":34.9802291},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":9,"location":{"latitude":32.8096812,"longitude":34.9775619},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":10,"location":{"latitude":32.8040826,"longitude":34.9776968},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":11,"location":{"latitude":32.8043399,"longitude":34.9789342},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":12,"location":{"latitude":32.80149730000001,"longitude":34.976059},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":13,"location":{"latitude":32.8016124,"longitude":34.9792118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":14,"location":{"latitude":32.8003985,"longitude":34.9822105},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":15,"location":{"latitude":32.7988096,"longitude":34.9752847},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":16,"location":{"latitude":32.7951851,"longitude":34.9756281},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":17,"location":{"latitude":32.7971578,"longitude":34.9886685},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":18,"location":{"latitude":32.7997621,"longitude":34.985468},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":19,"location":{"latitude":32.8082998,"longitude":34.9879481},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":20,"location":{"latitude":32.8017594,"longitude":34.99886050000001},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":21,"location":{"latitude":32.804539,"longitude":34.989972},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":22,"location":{"latitude":32.8230697,"longitude":34.9719067},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":23,"location":{"latitude":32.8200018,"longitude":34.9678621},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":24,"location":{"latitude":32.8207458,"longitude":34.9867118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"}],"type":"SimpleRequest","roadnetwork":true,"costvalue":"TravelTime"}

    This is the response. It won't take more than 3 drivers.

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2020 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","errorDetails":["One or more parameters are not valid.",": Invalid number of agents, maximum number of agents supported is 3"],"resourceSets":[],"statusCode":400,"statusDescription":"Bad Request","traceId":"f77100a2c0fd4ca4813943fa419a1ae2|HK00000C10|0.0.0.0"}


    Now with 3 drivers:

    [20-05-18 23:07:34:401 IDT] {"agents":[{"name":"Driver1","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver2","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]},{"name":"Driver3","shifts":[{"startTime":"2020-05-14T01:00:00","endTime":"2020-05-14T23:00:00","startLocation":{"latitude":"32.2816791","longitude":"34.8821884"}}]}],"itineraryItems":[{"name":3,"location":{"latitude":32.7580562,"longitude":34.97382},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":4,"location":{"latitude":32.759846,"longitude":34.976456},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":5,"location":{"latitude":32.8158068,"longitude":34.9644042},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":6,"location":{"latitude":32.8126147,"longitude":34.9670024},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":7,"location":{"latitude":32.8073497,"longitude":34.9767602},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":8,"location":{"latitude":32.8084959,"longitude":34.9802291},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":9,"location":{"latitude":32.8096812,"longitude":34.9775619},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":10,"location":{"latitude":32.8040826,"longitude":34.9776968},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":11,"location":{"latitude":32.8043399,"longitude":34.9789342},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":12,"location":{"latitude":32.80149730000001,"longitude":34.976059},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":13,"location":{"latitude":32.8016124,"longitude":34.9792118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":14,"location":{"latitude":32.8003985,"longitude":34.9822105},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":15,"location":{"latitude":32.7988096,"longitude":34.9752847},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":16,"location":{"latitude":32.7951851,"longitude":34.9756281},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":17,"location":{"latitude":32.7971578,"longitude":34.9886685},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":18,"location":{"latitude":32.7997621,"longitude":34.985468},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":19,"location":{"latitude":32.8082998,"longitude":34.9879481},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":20,"location":{"latitude":32.8017594,"longitude":34.99886050000001},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":21,"location":{"latitude":32.804539,"longitude":34.989972},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":22,"location":{"latitude":32.8230697,"longitude":34.9719067},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":23,"location":{"latitude":32.8200018,"longitude":34.9678621},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"},{"name":24,"location":{"latitude":32.8207458,"longitude":34.9867118},"dwellTime":"00:10:00.00","priority":1,"openingTime":"2020-05-14T01:00:00","closingTime":"2020-05-14T23:00:00"}],"type":"SimpleRequest","roadnetwork":true,"costvalue":"TravelTime"}

    Same error about number of itineraries

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2020 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","errorDetails":["One or more parameters are not valid.",": Invalid number of itinerary items, maximum number of items to be scheduled is 20"],"resourceSets":[],"statusCode":400,"statusDescription":"Bad Request","traceId":"2554cc4fb5304c0b82a03bd01d7587eb|CH000010A0|0.0.0.0"}

    Can someone help me figuring out the problem?

    Monday, May 18, 2020 8:10 PM
  • Should I fill a bug report?
    Saturday, May 23, 2020 7:01 AM
  • Hi Stephane,

    I have escalated this to the team but do not have a response as yet.  You could certainly file a support request if you wish. If you do, please let the Support Engineer know your item is being tracked in Geo Feedback #2797948.

    Sincerely,

    IoTGirl



    Saturday, May 23, 2020 9:45 PM
    Owner
  • Thank you very much!

    I will wait patiently :)

    Sunday, May 24, 2020 2:12 PM
  • Hi Stephane,

    Monday is a holiday in the US so the team is currently out of the office.  Hopefully they can take a look at this in the next week.

    UPDATE: The answer is that the Basic Key you are using is limited to 2 Agents and 20 items so the behavior you are seeing is expected.  The team will be fixing the documentation to reflect more Agents and Items for Enterprise Keys and the numbers are higher than those stated on the site now. This is due to the complexity of the call in the background  To purchase an Enterprise Key you can reach out to MapLic@Microsoft.Com if you are in the Americas or MapEMEA@Microsoft.com if you are in the rest of the world.

    Sincerely,

    IoTGirl


    Monday, May 25, 2020 5:10 PM
    Owner