The REST API is a gateway for mobile devices, websites and mobile terminals for data interchange with the Retail Head-Office. The APICORE is an intermediate POS business logic engine with a local data base. The APICORE simulates POS functionality and facilitates data queries and transactions recording.
The API services are provided according to different hierarchic licenses:
The data interchange protocol used by the API is REST. All the services and queries included in the API can accept parameters and return data and error codes in REST protocol.
The REST protocol is used between the API and the external terminal only. All the queries validates the unique terminal identifier and returns an error code in case the terminal is not properly registered.
Queries which returns arrays, will return empty arrays in case no relevant data was retrieved.
Priority API integration guide
All queries will return an error structure named EdeaError.
One of the characters of the EdeaError structure is the ErrorSource. When this character holds a value other than '0', an error has occurred.
If the value held by the ErrorSource is 5 (Five), the error is a business logic error. In this case the ErrorCode character should be addressed to retrieve the specific error.
Note: that in some cases the value in the ErrorCode might refer to another error object in the error structure, for example:
The ErrorSource object in the EdeaError structure returned the value 5 (Five) which indicates a business logic error when the "Register Final Order" method had been approached.
The ErrorCode field returned the value 6 (six). This value indicates an error in creating or updating a POS customer record. In order to identify the specific error returned from this service, the value returned in the ErrorCode of the "Create or Update POS Customer" error object should be referred to.
The application manages a locking mechanism to prevent executing simultaneous operations on the same transaction. The lock is based on the temporary transaction number.
When an operation is received at the same time on the same transaction, the error code will be -10 - Operation already executing on same entity. In this case the operation should be retried after a short delay.
For example:
If 30 requests to update the a transaction were sent at the same time, and 10 of them were on the same transaction number and other 20 are for different transaction numbers each, only one of the 10 operations will be able to execute and other 9 operations will receive an error code of -10 and will have to try again.
The rest of the 20 operations, since they're each for a separate transaction number will execute in parallel.
Creating a new transaction is limited with this locking mechanism, but is based on point sale and branch code instead of the temporary transaction number.
Since the specific operations execute fast, the definition of simultaneous is at the second or less.
Error codes
The REST API uses gzip for data compression
Instructions and samples are available at : Code examples.
The queries which are intended to retrieve massive volume of data, returns the data in Chunks i.e. the data is divided to few chunks of data. The number of chunks returned, is depending on the amount of data returned by the query.
The methods returning chunks, receives timestamp and number of chunk as parameters.
The query retrieves all data with update timestamp equal or higher than the timestamp parameter and set the data in 100 records chunks. The service will return the chunk number requested in the chunk number parameter provided to the query.
These services, using the chunks mechanism, should be operated as follows: