Rest API POST doc from HansaWorld
Writing Data to Standard ERP
Functionally RecordNew will be called, then each set command will be called in order with it's respective window actions (to fill e.g. customer's name and payment terms). Finally the record will be inserted calling the same record actions as if a user did it with a client. There is no limit to the number of set commands you can issue, they can be either in the url or in post data. Only fields with non-default (non blank) data is returned.
Note the "url" parameter that uniquely identifies the created record. If you have more than one field in the main key these fields will be separated by '/'. If the main key contains special characters they will be url encoded.
In case of any messages that user would receive when entering the data manually, these messages will be returned in following format: <message description='message_text'></message>
In case of error while inserting/updating a record, following will be returned: <error code='error_code' description='error description' row='row_no' field='field_name'></error>
POST
To create new records you POST to the registers. The 'set' commands have the same syntax and functionality as with POST.
Example:
curl -X POST 'http://SJ:@127.0.0.1:8080/api/1/IVVc?set_field.CustCode=001&set_row_field.0.ArtCode=10101&set_row_field.0.Quant=3';
The reply will be in this format:
<data register="IVVc" sequence="9693" url="/api/1/IVVc/10000014" systemversion="8.5.15.5" <IVVc>
<SerNr>10000010</SerNr>
<InvDate>2018-05-30</InvDate>
<CustCode>001</CustCode>
<Math/>
<PayDate>2018-06-29</PayDate>
<Addr0>Against All Odds Trading Co</Addr0> ... <rows>
<row rownumber="0">
<stp>1</stp>
<ArtCode>10101</ArtCode>
<Quant>3</Quant>
<Price>25.00</Price>
<Sum>71.25</Sum>
This will create a new invoice for 001 customer, adding 3 10101 items.
PATCH
To change an existing record you PATCH the url given in the POST command.
Example:
curl -X PATCH 'http://SJ:@127.0.0.1:8080/api/1/IVVc/10000014?set_row_field.0.Quant=100'
The reply will be in the same format:
<data register="IVVc" sequence="9729" url="/api/1/IVVc/10000014" systemversion="8.5.15.6" <IVVc>
<SerNr>10000014</SerNr> ... <rows>
<row rownumber="0">
<stp>1</stp>
<ArtCode>10101</ArtCode>
<Quant>100</Quant>
<Price>25.00</Price>
<Sum>2375.00</Sum>
This will change the quantity to 100.