Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

What is REST API?

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.

...

A RESTful API breaks down a transaction to create a series of small modules. Each module addresses a particular underlying part of the transaction. This modularity provides developers with a lot of flexibility. 

How to set up Burti REST API?

Initial setup is rather complicated, so we do it for the costumer. However, there are some prerequisites that needs to be done, in order to set it up:

...

Request full details for a specific Item

 sample.json.txt  - made to the READ interface Web_JSON_Composer.hal:

...

  1. query - the specific data interface (will be a separate interface for each register). In this case it's "Web_JSON_INVc_List.hal" for Items (register code INVc) - the naming of this interface will be the same accross all registers.
  2. full - whether to request the full data or a shorter list of fields - these fields are configured separately
  3. index - the index in Hansaworld's datadef, by which to lookup the data, advanced topic, simply use "Code" (might be something other for other registers)
  4. Code - the field name within the index, simply use "Code" (might be something other for other registers)
  5. fieldcnt - number of fields within the index, use 1 (might be something other for other registers)
  6. company - the company number from which we are requesting the data
  7. fieldlist - list of the fields within the index, comma separated, use "Code" (might be something other for other registers)

Response file response.get1get.json

Request full list of items

 sample.getjson-2.data2.txt - made to the READ interface Web_JSON_Composer.hal:

...

Only describing new options that are not described above:
# sort_only - this will use the provided index name as a sort order only, and will not try to look up specific data (used when listing all records within a register)

Response file  response.get2.json

Insert a new item

 sample.post.data.txtjson - made to the WRITE interface Web_JSON_UpdatingComposer.hal:

Code Block
{
	"0": {
		"name": "WEB_JSON_INVc_Save.hal",
		"company": 21,
		"data": {
			"action": "insert",
			"matrix": [],
			"Code": "10101",
			"Name": "Piano New",
			"Unittext": "STK"
		}
	},
	"21": {
		"name": "WEB_JSON_INVc_Save.hal",
		"company": 21,
		"data": {
			"action": "insertupdate",
			"matrix": [],
			"Code": "1010210120",
			"Name": "Klarinett New",
			"Unittext": "STK"
		}
	}	
}

...

  1. name - the name of the update interface. The principle is similar to the read interfaces.
  2. company - the company number to use for inserting data
  3. data - the data block
  4. action - insert/update/delete
  5. matrix - to be used with matrix rows - array of rows in the same format as the following
  6. Code , - Usually the main index key for records. For "Insert" actions should be blank
  7. Name,Unittext- database fields to update with values.

Response file file response.post.json It It contains no warnings or errors, but the format in which such errors would be received, can be seen in the file.

...