REST models with single service APIs?

edited December 18, 2017 in Questions
Is it possible to use declarative REST models without a query method? For example, currently I'm unable to use a service-based API (POST data to one endpoint, receive a response), as it isn't a traditional CRUD API, and doesn't have GET response.

The current REST models seem to require CRUD operations to function. Is there a way around this, or am I restricted to a custom JS solution for now?

Comments

  • edited December 14, 2017
    I was just doing this. I defined a create method and fields for each item I wanted to send in the request or retrieve from the response. In an action I then added a row to the model and then saved the model.
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN 💎💎💎
    edited December 14, 2017
    You can do this by adding Model Fields for both request and response information, to the same Model. For example, let's say your Model has an Insert method that does a POST, and you need to send fields "Foo" and "Bar". You would define two Model Fields, "Foo", and "Bar". Now, if the response from the POST is expected to return fields "Alpha" and "Beta", you should add these as Model Fields as well. Then, in your Insert method config, make sure that "Created record will be returned in response body" is selected. After the POST response comes back, if it contains "Alpha", "Beta", "Foo", and / or "Bar" properties, these will all be populated into the corresponding fields in the Model rows.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!