Skip to main content
1-Visitor
Mar 28, 2019 3:03 AM UTC
Question

Error making a REST API call from Thingworx - Illegal Character

Hi All,

 

I am creating a service within a "Thing" and the service tries to get data from a REST API endpoint. I am using "ContentLoaderFunctions" (GetJSON) to send the GET request to the endpoint. It works well, when the URL doesn't have any special characters.

But it throws an error "llegal character in query at index 57: https://myserver/webapi/resource?path=myparameter"

 

As anyone faced this issue? Is there any function available to encode the URL ?

 

Regards,

Jaison Rodrigues

5 replies

5-Regular Member
Mar 28, 2019 3:19 AM UTC

did you check the URLEncoder?

 

Thanks,

Sami

Translate
1-Visitor
Mar 28, 2019 6:27 AM UTC

Yes. I tried to use it but it gives me error. Not sure if I am using it correctly since I am using JAVA syntax.

 

 

Translate
1-Visitor
Mar 28, 2019 11:22 PM UTC

The platform does not accept "\" and considers it as an "Illegal Character". "?, &, -, =" works fine. I replaced "\" with "%5C" and it worked.

Translate
Support
Apr 17, 2019 3:33 PM UTC

Hi @jaison.

 

If you are comfortable with the solution you found, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Translate
jaison1-VisitorAuthor
1-Visitor
Apr 17, 2019 9:27 PM UTC
It’s more a workaround than a solution. Still looking for a solution if some in the community has used URLEncoder successfully to make a REST API call or any other method that encodes the URL is standard format.
Translate