URL Parameters in RESTlet for POST Method

Hi All,

Is there any way to get the URL parameters inside the POST method of a SuiteScript 2.0 RESTlet.

I’d like to to create a gateway type endpoint and use the URL parameters to determine which handler code to execute to deal with the request.

e.g. {{URL}}&type=customer ==> Invoke customer POST handler.

I appreciate that I could do this via multiple RESTlets or using the data in the POST body but the approach I’m aiming for is more like what you might typically see with an API.



Intermediate Asked on November 12, 2019 in SuiteScript.
Add Comment
1 Answer(s)

Use context.request.parameters.your_url_parameter

so for your example it would be context.request.parameters.type

Beginner Answered on November 12, 2019.

I think that’s only available in Suitelets?

There’s an equivalent requestParams in the RESTlet GET method but nothing that seems to be available in POST.

on November 12, 2019.

Ok for RESTlets its just context.param or specific to your example it would be context.type

on November 12, 2019.

Thanks ebarro but that doesn’t get me URL parameters in the case of a POST request.

on November 14, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor