Using the Rest API to POST a new record

I have Adabas running in a Docker container with the demodb running. I want to insert a record into the VEHICLES file using the Rest API. I can see in the Swagger API screen the format of the POST URL, however, I am at a loss as to providing the payload for the new record.

I can see that the data/body of the call has the following:

{ “stores”: { }, “records”: { } }

  • Is this where the data goes for the new record? (I assume yes)
  • What is “stores” and “records”?
  • How would I format this payload according to the VEHICLES file structure?

Thanks in advance

Hi,

the entry point could be “Store:” and in newer version “Records:”.
Here an Example JSON which will insert (POST) or update (PUT) the records using classic notation with /rest/db//:

{“Store”:[{“A2”:[{“AM”:“44864858”,“AN”:“1033”}],“A1”:[{“AK”:“89300”,“AL”:“F”,“AI”:[“STREET”],“AJ”:“TEST”}],“AA”:“RINSERT1”,“AB”:[{“AC”:“INSERT”,“AD”:"",“AE”:“TEST”}],“AQ”:[{“AT”:[138],“AS”:963,“AR”:“EUR”}],“A3”:[{“AV”:5,“AU”:19}],“AG”:“F”,“AH”:712981,“AW”:[{“AX”:19990801,“AY”:19990831}],“AF”:“M”,“AZ”:[“FRE”,“ENG”],“ISN”:1,“AO”:“VENT59”,“AP”:“CHEF DE SERVICE”}]}

Similar is possible using the Adabas MAP (/rest/map//case). There long names are used:
{“Store”:[{“Personnel-id”: “RINSERT1”,“FullName”:[{“FirstName”:“INSERT”,“Name”:“TEST”}]}]}

Bye,
Thorsten

Thank you, Thorsten

I’ve created a new file to insert data into - do you know how I might create a map for my new FDT?

A rich client and tools to import/define Adabas Maps is part of an Software AG product called “Adabas Client for Java”. It is not part of a community edition.

It may be possible to have a look on the Golang driver at GitHub - SoftwareAG/adabas-go-api: This module provides direct access to Adabas database data in a Golang-based application. This contains all transactional operations on the database. .
There the Map is described in detail and you can generate your map directly on the DATA_DESIGNER file. You can use the HTTP POST like you did with your new record.
Detail description of Adabas Maps is here adabas-go-api/AdabasMap.md at master · SoftwareAG/adabas-go-api · GitHub .

If you know Golang you can use the Go Adabas driver to import Maps.
If you created the demo database during startup, a file called “DATA_DESIGNER” is already generated. In version 7 of Adabas Docker Community edition is providing a small web page for administration and testing. Just open the RESTful server port.

Bye,
Thorsten

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.