Unable to Execute a Bing Map GET REST Request

Whenever I try to run this REST API to Bing Maps i get an error which i’m unable to solve. reqeusting your help here…

Widget Used = Get Request
URL: http://dev.virtualearth.net/REST/V1/Routes/OptimizeItinerary?itineraryAgents=%20agentName_2018-12-24T08:00:00|47.694117204371,-122.378188970181|2018-12-24T11:00:00|47.7070790545669,-122.355226696231_2018-12-24T13:00:00|47.694117204371,-122.378188970181|2018-12-24T19:00:00|47.7070790545669,-122.355226696231&itineraryItems=2018-12-24T09:00:00_2018-12-24T18:00:00_01:31:08.3850000_47.692290770423,-122.385954752402_5;2018-12-24T09:00:00_2018-12-24T18:00:00_01:00:32.6770000_47.6798098928389,-122.383036445391_88;2018-12-24T09:00:00_2018-12-24T18:00:00_01:18:33.1900000_47.6846639223203,-122.364839942855_1;2018-12-24T09:00:00_2018-12-24T18:00:00_01:04:48.7630000_47.6867440824094,-122.354711700877_3;2018-12-24T09:00:00_2018-12-24T18:00:00_02:34:48.5430000_47.6962193175262,-122.342180147243_16&key=AqQ2k03x_D11cfQdg6VyuLPIUAP3i2qo08uzzs16Mj22No80Q_6pa6C3Fn7RqRtu

This runs fine in a browser status 200 is received however on Knime… below is the error received, can anyone please help me out.

illegal charter in query at index 874

Error as below:

Hi there @pawantejani,

welcome to KNIME Community Forum!

You are seeing this error cause of vertical bar ("|") character. See more here: https://stackoverflow.com/questions/18316242/cannot-process-url-with-vertical-pipe-bar-in-java-apache-httpclient

I replaced it with “%7C” and your URL works just fine :wink:

Br,
Ivan

2 Likes

Hi Ivan,

thank you for the response.

i had made that change already,in fact i had made that change of pipe/vertical bar character what shows as error is the last character in the string. apologies i didn’t mention that I’ve made the change of pipe/vertical bar to %7C… if you look at the screenshot for the error it shows I’ve changed the character to %7C. please help.

I suggest to give Palladian’s HTTP Retriever a try. Looks like it’ll load the URL just fine (tried and got a 200 response).

Get Palladian from here:

3 Likes

Hey Phillipp,

Thank you so much for your response, yes i tried the http retreiver however i am not getting the desired output, sorry i’m new to knime and never found a working sample wherein this node has been used. apologies, i need the output to be something like this which i can convert to table later on.

again thanks in advance for your help.

Blockquote
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2019 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.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"OptimizeItinerary:http://schemas.microsoft.com/search/local/ws/rest/v1","agentItineraries":[{"agent":{"capacity":[],"name":" agentName","shifts":[{"endLocation":{"latitude":47.7070790545669,"longitude":-122.355226696231},"endTime":"2018-12-24T11:00:00","startLocation":{"latitude":47.694117204371,"longitude":-122.378188970181},"startTime":"2018-12-24T08:00:00"},{"endLocation":{"latitude":47.7070790545669,"longitude":-122.355226696231},"endTime":"2018-12-24T19:00:00","startLocation":{"latitude":47.694117204371,"longitude":-122.378188970181},"startTime":"2018-12-24T13:00:00"}]},"instructions":[{"instructionType":"LeaveFromStartPoint","itineraryItem":{"closingTime":"0001-01-01T00:00:00","dropOffFrom":,"dwellTime":"00:00:00","location":{"latitude":47.694117204371,"longitude":-122.378188970181},"openingTime":"0001-01-01T00:00:00","priority":1,"quantity":},"startTime":"2018-12-24T08:52:30"},{"distance":2178,"duration":"00:07:30","endTime":"2018-12-24T09:00:00","instructionType":"TravelBetweenLocations","startTime":"2018-12-24T08:52:30"},{"duration":"01:00:32","endTime":"2018-12-24T10:00:32","instructionType":"VisitLocation","itineraryItem":{"closingTime":"2018-12-24T18:00:00","dropOffFrom":,"dwellTime":"01:00:32.6770000","location":{"latitude":47.6798098928389,"longitude":-122.383036445391},"openingTime":"2018-12-24T09:00:00","priority":88,"quantity":},"startTime":"2018-12-24T09:00:00"},{"distance":4285,"duration":"00:10:52","endTime":"2018-12-24T10:11:24","instructionType":"TravelBetweenLocations","startTime":"2018-12-24T10:00:32"},{"instructionType":"ArriveToEndPoint","itineraryItem":{"closingTime":"0001-01-01T00:00:00","dropOffFrom":,"dwellTime":"00:00:00","location":{"latitude":47.7070790545669,"longitude":-122.355226696231},"openingTime":"0001-01-01T00:00:00","priority":1,"quantity":},"startTime":"2018-12-24T10:11:24"},{"instructionType":"LeaveFromStartPoint","itineraryItem":{"closingTime":"0001-01-01T00:00:00","dropOffFrom":,"dwellTime":"00:00:00","location":{"latitude":47.694117204371,"longitude":-122.378188970181},"openingTime":"0001-01-01T00:00:00","priority":1,"quantity":},"startTime":"2018-12-24T13:00:00"},{"distance":1314,"duration":"00:04:39","endTime":"2018-12-24T13:04:39","instructionType":"TravelBetweenLocations","startTime":"2018-12-24T13:00:00"},{"duration":"01:31:08","endTime":"2018-12-24T14:35:47","instructionType":"VisitLocation","itineraryItem":{"closingTime":"2018-12-24T18:00:00","dropOffFrom":,"dwellTime":"01:31:08.3850000","location":{"latitude":47.692290770423,"longitude":-122.385954752402},"openingTime":"2018-12-24T09:00:00","priority":5,"quantity":},"startTime":"2018-12-24T13:04:39"},{"distance":4293,"duration":"00:09:41","endTime":"2018-12-24T14:45:28","instructionType":"TravelBetweenLocations","startTime":"2018-12-24T14:35:47"},{"duration":"02:34:48","endTime":"2018-12-24T17:20:16","instructionType":"VisitLocation","itineraryItem":{"closingTime":"2018-12-24T18:00:00","dropOffFrom":,"dwellTime":"02:34:48.5430000","location":{"latitude":47.6962193175262,"longitude":-122.342180147243},"openingTime":"2018-12-24T09:00:00","priority":16,"quantity":},"startTime":"2018-12-24T14:45:28"},{"distance":2230,"duration":"00:04:44","endTime":"2018-12-24T17:25:00","instructionType":"TravelBetweenLocations","startTime":"2018-12-24T17:20:16"},{"instructionType":"ArriveToEndPoint","itineraryItem":{"closingTime":"0001-01-01T00:00:00","dropOffFrom":,"dwellTime":"00:00:00","location":{"latitude":47.7070790545669,"longitude":-122.355226696231},"openingTime":"0001-01-01T00:00:00","priority":1,"quantity":},"startTime":"2018-12-24T17:25:00"}],"route":{"endLocation":{"latitude":47.7070790545669,"longitude":-122.355226696231},"endTime":"2018-12-24T17:25:00","startLocation":{"latitude":47.694117204371,"longitude":-122.378188970181},"startTime":"2018-12-24T08:52:30","totalTravelDistance":14300,"totalTravelTime":"00:37:26","wayPoints":[{"latitude":47.6798098928389,"longitude":-122.383036445391},{"latitude":47.7070790545669,"longitude":-122.355226696231},{"latitude":47.694117204371,"longitude":-122.378188970181},{"latitude":47.692290770423,"longitude":-122.385954752402},{"latitude":47.6962193175262,"longitude":-122.342180147243}]}}],"isAccepted":true,"isCompleted":true,"unscheduledItems":[{"closingTime":"2018-12-24T18:00:00","dropOffFrom":,"dwellTime":"01:18:33.1900000","location":{"latitude":47.6846639223203,"longitude":-122.364839942855},"openingTime":"2018-12-24T09:00:00","priority":1,"quantity":},{"closingTime":"2018-12-24T18:00:00","dropOffFrom":,"dwellTime":"01:04:48.7630000","location":{"latitude":47.6867440824094,"longitude":-122.354711700877},"openingTime":"2018-12-24T09:00:00","priority":3,"quantity":}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"35d80065cc74413c950311e1b1342561 HK00000BDA 7.7.0.0"}

Blockquote

Hi there @pawantejani,

I see. Then I would say you have extra character at the end cause I get the same message when I add space or tab at the end. Check that out.

I can share a workflow if you can’t get it to work.

Br,
Ivan

Hi ipazin,

please share the workflow it will make life easy to understand.

Thank you for your help.

Hi there,

here it is on KNIME Hub:
https://kni.me/w/o8HjoDY8LHMYQ7Er

Br,
Ivan

1 Like

Hey there,

and here’s an example using the HTTP Retriever node. What might be a bit confusing first is, that the Result column just seems to contain something such as statusCode=200,size=5291. In fact, this cell however holds the entire HTTP response content and you can simply pass this cell to e.g. the String to JSON node (and all other nodes which expect a String value).

Bonus: To extract all HTTP header information from the HTTP result, you can use this node:

Here’s a complete working example for you using Palladian on my NodePit Space:

Enjoy,
Philipp

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.