Skip to main content
7-Bedrock
January 18, 2017
Solved

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

  • January 18, 2017
  • 2 replies
  • 3290 views

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!

Best answer by ttielebein

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!

2 replies

5-Regular Member
January 18, 2017

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

5-Regular Member
January 18, 2017

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!

acc7-BedrockAuthor
7-Bedrock
January 19, 2017

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