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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to call services from a thing and return JSON format through REST?

acc
6-Contributor
6-Contributor

How to call services from a thing and return JSON format through REST?

Hello,

I created a thing with services that able to return a INFOTABLE.

I did tried to create another services that used .ToJSON() and return result in JSON base type.

Both way i couldn't get the result in JSON format when i use postman GET method.Untitled.jpg

REST return  Unexpected 'I' and i don't know what is this mean.


Can somebody tell me how to make it?

Thanks in advanced!

1 ACCEPTED SOLUTION

Accepted Solutions
ttielebein
12-Amethyst
(To:acc)

Calling services via REST API are POSTs not GETs. You need to change the type to POST and provide a content-type (likely just application/json). Hope this helps!

View solution in original post

3 REPLIES 3
ankigupta
5-Regular Member
(To:acc)

Hi Ang CC​, Try running the service directly from the composer and check result. Also, make sure to set datashape of the infotable in the script itself.

Check Application logs/Script logs for any error(s).

I hope it helps.

Thanks,

Ankit Gupta

ttielebein
12-Amethyst
(To:acc)

Calling services via REST API are POSTs not GETs. You need to change the type to POST and provide a content-type (likely just application/json). Hope this helps!

acc
6-Contributor
6-Contributor
(To:ttielebein)

Thanks Tori Tielebein​, POST is the correct way with the header content-type.

Top Tags