Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

get/post multiple records for a json array

Sorry if I dont have the terminology quite right.
I haven't investigated this thoroughly yet but if you could hep with a few pointers that would be appreciated.

I have a file with multiple 2 part key records, the major key belonging to say 1 ID.

I need to get all these records and pass them in a GET api as an object array (same as if were mv fields with amv labels)with the fields in each record. Tick, Tick-(I could create symbolics on the master record [for which there is already an API] that would create a mv array from the related keys, then on a POST trap and process to the associated file - Mmm maybe an easy way to go)

Then get it back PUT and disassemble the array and for each 'record' create a key and write the record.

In OI it is displayed in a table with each row being a record, the same way as it needs to be displayed in the web application(not me writing the web app)


  • edited March 2017
    I'm not sure if you are asking a REST design question or a programming question. If this is a REST design question, I would say that you have two ways to go with this:
    • Use query params to define the records you want to retrieve from your URL. This allows you to maintain a simple resource oriented URL (e.g., /caskets), but allow you to return multiple resources without having to return the entire collection (e.g., /caskets?{filter}={value}).
    • Create a new URL that is unique to this group of records, such as /casketgroup. If you are able to give the records a unique name (similar to a savelist), then you can append that to the URL to maintain a simple REST API (e.g., /casketgroup/{groupname}).
    On the programming side, it depends on what your URL looks like. You can still use the GetDatabaseItems service from HTTP_RESOURCE_SERVICES to GET a bunch of records since the first argument is a Filter. Filter can be SELECT sentence, an @FM list of Key IDs, or the name of a savelist.

    There is no way to POST/PUT records back as a group. You will need to parse these yourself and then you can call the PostDatabaseItem service one at a time.
  • Don,

    Thank you so much for your informative and comprehensive response.
    I would be looking at the RESTful approach.
    This helps me a lot in affirmation of my thinking.
Sign In or Register to comment.