cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Error making a REST API call from Thingworx - Illegal Character

jaison
3-Newcomer

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

did you check the URLEncoder?

 

Thanks,

Sami

jaison247
4-Participant
(To:smanickam)

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.

 

 

jaison247
4-Participant
(To:jaison247)

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

slangley
23-Emerald II
(To:jaison)

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

jaison
3-Newcomer
(To:slangley)

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.
Announcements


Top Tags