The OPERATION service is used to perform INSERT, UPDATE and DELETE operations on the central data system.
The service in question can be called up via the following URL: https://api.gooseapp.com/operation/
The JSON data structure must be sent by POST, below is an example of a call JSON:
{ code: "DEV001", key: "09mpada9nx4mxl3346055518sf89hcyga74mwmhucgf9j7cg78", operation: "UPDATE", table: "CON_TRO", id: "0-1", data: { CORAS: "Example", COTEL: "+39 011 12930939" } }
This call performs an UPDATE on the CON_TRO table with RECORD_ID "0-1" modifying the CORAS and COTEL fields.
The parameters available for the OPERATION calls are as follows:
Name
|
Type |
Mandatory
|
Description
|
---|---|---|---|
code
|
varchar(6) |
Yes |
Company code |
key
|
varchar(200) |
Yes |
Secure API Key |
operation
|
varchar(20) |
Yes |
Type of operation: • INSERT (enters a non-existing record) • UPDATE (updates an existing record) • UPDATE/INSERT (updates, if the record does not exist, it enters it) • DELETE (deletes an existing record) |
table
|
varchar(7) |
Yes |
Table name |
id
|
varchar(25) |
Yes/No |
relevant RECORD_ID. This parameter is only mandatory for the UPDATE and DELETE operations, whereas it can be omitted for the INSERT operations, in which case the central system will assign a RECORD_ID key. |
data
|
structure |
Yes/No |
Structure of data/values affected by input or modification. This is ignored in the case of DELETE operations, whereas it is mandatory in the case of INSERT and UPDATE operations. |
If the operation performed is successful you will obtain the following JSON:
{ status: "OK", result: { operation: "UPDATE", table: "CON_TRO", id: "0-1" } }
As a matter of fact, the system indicates that the UPDATE operation on the "0-1" record of the CON_TRO table was successful.
If the operation is not successful, the following JSON is obtained:
{ status: "error", error: { code: "120", description: "Unknown column 'COTEL2' in 'field list'", query: "UPDATE client_goose_DEV001.CON_TRO SET CORAS=..." } }
In case of an error, the status parameter shows an "error" value and the error code, a description of the error and the query performed are indicated in the error structure.
Do you want to ask us something?
Contact us at support@gooseapp.com