Skip to main content
Solved

FME Server 2021.0 API returns raw encoded string not value


Forum|alt.badge.img

Hi everyone,

 

I'm making a call to the FME Server API to get a list of Schedules and I'm getting back "raw" encoded strings in the json response, but I would like the "values". Is there any way to do it?

 

Here's an example request, which uses a token that I set up in FME Server (the token only has access to the Schedules) :

 

HTTPCaller 

The json returned looks like this : 

{"offset":-1,"limit":-1,"totalCount":65,"items":[{"owner":"me","request":{"publishedParameters":{"name":"MyURLAttribute","raw":"https:<solidus><solidus>myFMEServer.com<solidus>something<solidus>blah"}...

The "raw" values look like they're encoded eg. "<solidus>" instead of "/"

 

I was expecting :

{"offset":-1,"limit":-1,"totalCount":65,"items":[{"owner":"me","request":{"publishedParameters":{"name":"MyURLAttribute","value":"https://myFMEServer.com/something/blah"}...

I tried changing the "response encoding" to the system default but it didn't make a difference. 

 

Any ideas? 

 

 

Best answer by hollyatsafe

batesy wrote:

Hi @virtualcitymatt​ ,  I added an "Accept" header to accept application/json but it didn't make any difference, I still get "raw" and not "value". The "Response Body Encoding" only has binary/unicode/latin, etc encoding options : 

 

Header optionsThe Published Parameters in the Schedule are text.

 

I also tried getting the Schedules via the API doc "Try me out" option using the same token and got the same results :

https://myserver/fmerest/apidoc/v3/#!/schedules/list_get_0

The token only has Access privileges to Schedules. However, if I grant it "All permissions" I get "values" not "raw" which is what I want, so I suspect that the token needs more privileges than just "Access" to the Schedules. 🙂 

 

Hi @batesy​ ,

Great detective work! I observe the same issue that if a token is granted 'Access' to the Schedules Item only, all the Schedules are returned but the published parameters return "raw" rather than "value" keys. In my testing, it looks like if you set 'Read' permissions for the Repository the scheduled workspace is stored in this should be enough to get the correct result returned - instead of giving the token all permissions. 

 

I will be filing an issue to request a fix, but that being said, in my testing the raw values always showed the correct characters and never the encoded <> values. What parameter type is your URLAttribute and was the workspace created in FME Desktop 2021 or an older version? 

View original
Did this help you find an answer to your question?

5 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+34

Did you try setting the response body encoding to "application/json"

 

You mentioned system default, however, it should be set to json. Might not help though.

 

What is the Published Parameter type set in the workspace?


Forum|alt.badge.img
  • Author
  • July 26, 2021

Hi @virtualcitymatt​ ,  I added an "Accept" header to accept application/json but it didn't make any difference, I still get "raw" and not "value". The "Response Body Encoding" only has binary/unicode/latin, etc encoding options : 

 

Header optionsThe Published Parameters in the Schedule are text.

 

I also tried getting the Schedules via the API doc "Try me out" option using the same token and got the same results :

https://myserver/fmerest/apidoc/v3/#!/schedules/list_get_0

The token only has Access privileges to Schedules. However, if I grant it "All permissions" I get "values" not "raw" which is what I want, so I suspect that the token needs more privileges than just "Access" to the Schedules. 🙂 

 


virtualcitymatt
Celebrity
Forum|alt.badge.img+34
batesy wrote:

Hi @virtualcitymatt​ ,  I added an "Accept" header to accept application/json but it didn't make any difference, I still get "raw" and not "value". The "Response Body Encoding" only has binary/unicode/latin, etc encoding options : 

 

Header optionsThe Published Parameters in the Schedule are text.

 

I also tried getting the Schedules via the API doc "Try me out" option using the same token and got the same results :

https://myserver/fmerest/apidoc/v3/#!/schedules/list_get_0

The token only has Access privileges to Schedules. However, if I grant it "All permissions" I get "values" not "raw" which is what I want, so I suspect that the token needs more privileges than just "Access" to the Schedules. 🙂 

 

Wow crazy find about the permissions. This sounds like a bug to me. Perhaps @jennaatsafe​  or @andreaatsafe​ can pass it to the dev team to look at. 


Forum|alt.badge.img+2
  • Best Answer
  • July 27, 2021
batesy wrote:

Hi @virtualcitymatt​ ,  I added an "Accept" header to accept application/json but it didn't make any difference, I still get "raw" and not "value". The "Response Body Encoding" only has binary/unicode/latin, etc encoding options : 

 

Header optionsThe Published Parameters in the Schedule are text.

 

I also tried getting the Schedules via the API doc "Try me out" option using the same token and got the same results :

https://myserver/fmerest/apidoc/v3/#!/schedules/list_get_0

The token only has Access privileges to Schedules. However, if I grant it "All permissions" I get "values" not "raw" which is what I want, so I suspect that the token needs more privileges than just "Access" to the Schedules. 🙂 

 

Hi @batesy​ ,

Great detective work! I observe the same issue that if a token is granted 'Access' to the Schedules Item only, all the Schedules are returned but the published parameters return "raw" rather than "value" keys. In my testing, it looks like if you set 'Read' permissions for the Repository the scheduled workspace is stored in this should be enough to get the correct result returned - instead of giving the token all permissions. 

 

I will be filing an issue to request a fix, but that being said, in my testing the raw values always showed the correct characters and never the encoded <> values. What parameter type is your URLAttribute and was the workspace created in FME Desktop 2021 or an older version? 


Forum|alt.badge.img
  • Author
  • August 1, 2021
hollyatsafe wrote:

Hi @batesy​ ,

Great detective work! I observe the same issue that if a token is granted 'Access' to the Schedules Item only, all the Schedules are returned but the published parameters return "raw" rather than "value" keys. In my testing, it looks like if you set 'Read' permissions for the Repository the scheduled workspace is stored in this should be enough to get the correct result returned - instead of giving the token all permissions. 

 

I will be filing an issue to request a fix, but that being said, in my testing the raw values always showed the correct characters and never the encoded <> values. What parameter type is your URLAttribute and was the workspace created in FME Desktop 2021 or an older version? 

Hi @hollyatsafe​ , thanks for the reply! You're spot on - the token needs read access to the repository. That's great to know! 😀 

 

The published parameters I'm using are just text, nothing fancy. I'm using FME Database Edition (node locked-crc) 2021.0.3.0 (20210528 - Build 21326 - WIN64) and FME Server 2021.0.3 Build 21326 - win64.

 

For anyone else that ever has a similar problem, I ended up writing a function in a PythonCaller to decode the raw strings :

 

        def raw_decoder(raw_string):
            """
            Converts a raw encoded string back to a string.
            """            
            raw_string_decoded = raw_string.replace("<solidus>""/") \
            .replace("<backslash>""\\") \
            .replace("<openbracket>""[") \
            .replace("<closebracket>""]") \
            .replace("<opencurly>""{") \
            .replace("<closecurly>""}") \
            .replace("<openparen>""(") \
            .replace("<closeparen>"")") \
            .replace("<gt>"">") \
            .replace("<lt>""<") \
            .replace("<apos>""'") \
            .replace("<at>""@") \
            .replace("<comma>"",") \
            .replace("<dollar>""$") \
            .replace("<quote>""\"") \
            .replace("<semicolon>"";") \
            .replace("<space>"" ") 
 
            return raw_string_decoded

But I don't need it now I know about the read permissions. Great stuff, thanks again Holly!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings