REST GET with payload

dj21
Giga Expert

We are working on a SNOW solution to provide a custom table data to an external system using Scripted REST GET API.

External system has a list of sysids and would invoke the GET API with a request(JSON payload - object array of sysids). Expectation on service now is to query the custom table and return the record values in the response(JSON Payload).

So on the API GET resource I have tried to retrieve the payload as "request.body"; But this options looks not possible as request.body is allowed on SNOW only for POST/ PUT.

Please suggest if there are other possible ways to retrieve the request as JSON.

GET error.jpg

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dj2,



Yes GET method doesn't support request body since in GET method only values are sent in URL.


you make the method as POST and this should work.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dj,



Any update on this?


Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dj2,



Any update on this?


Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dj2,



Any update on this?


Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader