Solved

Query string parameters with HTTPcaller problem

  • 15 June 2021
  • 6 replies
  • 25 views

Hi,

I'm currently trying to do a itinerary with my HTTPCaller with the posibility to have 2 itinerary. You can see the the request url that I'm getting. The query string parameters have a parameter called "Choixroute" which is the route choosen, going from 0 to 1. When the "choixRoute" is at 0,the result is the road option 1 . But, when I change it to 1, it is still the road options 1 and not the option 2. Is it something that I have to change in my HTTPCaller or in JSONfragmenter?

 

Thank you in advance,

 

Ian

icon

Best answer by hollyatsafe 16 June 2021, 23:12

View original

6 replies

Badge +2

Hi @Ian Gagnon-Renaud​ ,

In your Request URL in the HTTPCaller you are not currently defining the coords and choixroute as query string parameters. These must be set up after the question mark in your URL in the form key=value and separated by an ampersand (&).

 

You can either alter your request URL e.g.

 

Screen Shot 2021-06-15 at 11.56.33 AMor you can use the Query String section, and the request URL will be correctly populated with these key-pair values. e.g.

Screen Shot 2021-06-15 at 11.55.45 AMI personally prefer to make use of the Query String Parameters section as I find it easier to view what I have set up and this means I won't make any mistakes joining multiple query string parameters together. You can do this with the token and demandeAspvhn parameters as well.

 

 

Hi @Ian Gagnon-Renaud​ ,

In your Request URL in the HTTPCaller you are not currently defining the coords and choixroute as query string parameters. These must be set up after the question mark in your URL in the form key=value and separated by an ampersand (&).

 

You can either alter your request URL e.g.

 

Screen Shot 2021-06-15 at 11.56.33 AMor you can use the Query String section, and the request URL will be correctly populated with these key-pair values. e.g.

Screen Shot 2021-06-15 at 11.55.45 AMI personally prefer to make use of the Query String Parameters section as I find it easier to view what I have set up and this means I won't make any mistakes joining multiple query string parameters together. You can do this with the token and demandeAspvhn parameters as well.

 

 

Hi Hollyatsafe,

 

Thanks for answering. I've tried many way to put the the parameters in the URL or in the Query string. You can see in the file attached, the http1-3 doesn't work and return a rejected transformer. But the http4 formulation works. Is there a problem with the parameters choixRoute?

Badge +2

Hi Hollyatsafe,

 

Thanks for answering. I've tried many way to put the the parameters in the URL or in the Query string. You can see in the file attached, the http1-3 doesn't work and return a rejected transformer. But the http4 formulation works. Is there a problem with the parameters choixRoute?

Hi @Ian Gagnon-Renaud​ ,

 

Hmm, revisiting the screenshots you provided I see the Query String being captured in Developer tools is from the FME Data Streaming Request URL so is the published user parameters being input into the workspace, not the setup required for the v1/driving endpoint for geoegl URL.

 

Do you have any documentation or screenshots of the successful requests in the web browser to the v1/driving endpoint? This will help us understand how the URL needs to be set up.

Hi Hollyatsafe,

 

Thanks for answering. I've tried many way to put the the parameters in the URL or in the Query string. You can see in the file attached, the http1-3 doesn't work and return a rejected transformer. But the http4 formulation works. Is there a problem with the parameters choixRoute?

Hi @hollyatsafe​ ,

The link below show offer you the information you need on the URL.

 

http://project-osrm.org/docs/v5.24.0/api/#nearest-service

Badge +2

Hi Hollyatsafe,

 

Thanks for answering. I've tried many way to put the the parameters in the URL or in the Query string. You can see in the file attached, the http1-3 doesn't work and return a rejected transformer. But the http4 formulation works. Is there a problem with the parameters choixRoute?

Hi @Ian Gagnon-Renaud​ ,

 

Aha this is perfect. So in your request, you are using the Route Service. Reviewing the optional parameters the one of interest is "alternatives". The description for this parameter is "Search for alternative routes", however, the default value is false, which means if it is not defined in your request only a single route is returned.

 

Therefore to bring in all route options you must add the query string alternatives=true.

 

Then in your JSONFragmenter, you'll need to point the JSON Query to json["routes"][*]. This will fragment each different route option into its own feature. It looks like unlike in the Web UI, the API does not store the routes as 'Option 1' and 'Option 2' so you'll probably need to reconsider how you are using your choixRoute published parameter.

 

Please see the attached workspace for how I have set this up.

Hi Hollyatsafe,

 

Thanks for answering. I've tried many way to put the the parameters in the URL or in the Query string. You can see in the file attached, the http1-3 doesn't work and return a rejected transformer. But the http4 formulation works. Is there a problem with the parameters choixRoute?

Hi @hollyatsafe​, I don't why I haven't think of this. Thank you very much for your help!

Reply