Skip to main content
1-Visitor
March 28, 2019
Question

Error making a REST API call from Thingworx - Illegal Character

  • March 28, 2019
  • 5 replies
  • 3108 views

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
March 28, 2019

did you check the URLEncoder?

 

Thanks,

Sami

1-Visitor
March 28, 2019

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.

 

 

1-Visitor
March 28, 2019

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

Support
April 17, 2019

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

jaison1-VisitorAuthor
1-Visitor
April 17, 2019
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.