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

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

SOLVED
Highlighted
acc
Participant

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

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

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!

3 REPLIES 3

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

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

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

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!

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

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