Question

HTTPCaller changes URL to be unusable. Is there a way to gain more control?


Badge

The goal is to construct any know URL with parameters to call and return values to FME but FME HTTPCaller wants to mess with it which renders it useless.

 

The problem is that FMECaller messes with the format and messes up the URL rather than using the raw URL and just substituting values:

I need to be able to construct various different RESTful API calls and substitute values and not spend a great amount of time trying to predict what HTTPCaller will do when creating the final URL.

 

For example.

http://...../api/LSCustom/v1/rtcm2rp/@Value(routeid)&@Value(measure)?@Value(t)&@Value(caller)

Should look like this:

http://...../api/LSCustom/v1/rtcm2rp/routeid=0100000000000094-I&measure=57.25?t=true&caller=mefme

FME HTTPCaller creates this instead:

'http://..../api/LSCustom/v1/rtcm2rp/&?&&routeid=0100000000000035-I&measure=55.555&%3Ft=true&caller=mefme'

 

So it adds to areas incorrectly ....

I have no idea what or why it adds the &?&& before the routeid should be just a '/' forward slash

I think that the encoding of ? to %3F is understandable but it also inserts a ‘&’ ahead of it and messes up the call, it just needs a '?' not an '&' sign

Much of that format is dictated by the dotnet core rest interface already in existence I can’t change it.

How do I intercept and fix the URL and clean it up or prevent the incorrect values maybe with TextEncoder or something else?


6 replies

Userlevel 4
Badge +25
Could you try concatenating all parameters in to a single attribute and then adding that to the url?
Badge

Yes thank you that is my intention after thinking about it on the train last night. I am thinking that the StringConcatenator may do the trick but must try and will do so. I am still curious why HTTPCaller is too helpful in these cases it would be nice to have the option to just append variables and text with out it being too smart in these situations.

Userlevel 4
Badge +25

Yes thank you that is my intention after thinking about it on the train last night. I am thinking that the StringConcatenator may do the trick but must try and will do so. I am still curious why HTTPCaller is too helpful in these cases it would be nice to have the option to just append variables and text with out it being too smart in these situations.

AttributeManager is another one that can be used to get the same result. In fact, I'm sort of expecting the StringConcatenator to be deprecated in a future release.
Badge

I will check it out thanks

Badge

I think I will close the ticket as I was able to use AttributeManager to HTTPCaller and get the output from the API once the URL was constructed correctly. Now I just have to tell the Excel reader to stop reading if it runs out of data I will search for that trick next. Thanks for your great help!!!

Userlevel 4

My recommendation would be to not construct the entire URL manually, but to rely on the built-in functionality in the HTTPCaller, whenever possible.

Example:

It will automatically manage the & and ? for you, it will also manage proper URL encoding whenever necessary.

Reply