REST Datasource connection to External system

Hi Team, I am using version 11.2.8. I am trying to connect to an external rest endpoint using rest data source. For now the external endpoints are simple GET and POST, which do not expect any request body or query param. Both the endpoint return a simple json in response. When I try to use method as Query, both http verbs GET and POST work fine. However I am struggling to send the payload with the Query method and the POST verb. Moreover, When I try to use method as Update or Insert, external endpoint is itself not getting invoked. I am not seeing any errors on browser console and even network tab shows no call made to the endpoint. I tried this with Proxy active and Inactive both. Even arguments[0].changes returns me undefined. My requirement is pretty straight forward, I want to post the customised payload to an external web service on the changed items inside the model. I am stuck here, can you please help.

You need to have 2 different Methods in your REST Model:

(1) A Query method, which does a GET, URL being /api/users
(2) An Insert method, which does a POST, URL being /api/users

You can have the Model set to Query on page load if you want. Then you could have a Table component in your Page which is associated to that Model, and at runtime, create a new row in that table. Enter a value for the id, and then click Save. You need to Save the Model, NOT re-query it, in order for the newly-created row to get inserted (which executes the Model’s Insert method).

Hey Zach,  

Thanks for the solution and this works absolutely perfect.

However, the requirement here is a bit different, the external endpoint is a single POST endpoint returning 201 response on successful execution. There is no extra GET endpoint to know the response fields. The problem statement here is to send whatever changed on the skuid page to be sent as a JSON object to the external post endpoint. Is there a way to use just query with POST or Insert or Update with POST method to send these details through. I tried using just query with POST but struggling to identify how to send the custom request body of changed items.
Any help would be appretiated.

Thanks
Mayank

Hi Mayank, are you saying that this is, essentially, a “write-only” model, where you don’t need to query at all, you just need to perform an “insert”? If so, then you just need to have one Insert Method on your REST Model, whose HTTP Verb is set to POST. You don’t need a Query Method. You can manually define each field that you want to send to be in your Skuid Model, and therefore be in the POST body, just by clicking “Add Field” on the Model, then manually configure the Display Type of each field (e.g. text, boolean, number, etc.). At runtime, when you Save this Model, the POST request will be made.