TabShop JSON Interface

  • With TabShop app version 146 the HTTP REST protocol changes to improve security. Following changes are applied: Basic authentication is used instead of HTTP URL parameters. Payload of invoices push was changed to only contain plain JSON payload instead of form field encoded user and password.

TabShop JSON Interface represents a convenient way to customize the third party integration of your TabShop Android Point of Sale App into your own backend server system. The TabShop server synchronization interface was designed to offer a very flexible possibility to synchronize with any server technology.
TabShop server synchronization interface is based on HTTP commands that request (GET) or post (POST) specific TabShop resources that are encoded with JSON. TabShop requests following HTTP resources with HTTP GET request messages:

  • home: a simple server ping that has to respond with true to signal full server readiness.
  • stock: request a JSON stock list from the server
  • tax: request a JSON list of defined taxes
  • discount: request a JSON list of discounts

TabShop clients push invoices through HTTP POST:

  • invoice: TabShop posts recent invoices along with the invoice positions to your server

TabShop integration interface Details: 

A TabShop PRO Client App offers an open JSON interface to communicate with any central server over HTTP POST requests, either to receive a stock list update, or to notify the central server of invoices that were stored locally.
All communication is done via HTTP and the defined address of the central server (either an URL or an IP address.
An example Server URL is given here: http://www.pocketvnc.com/tshop

1. TabShop Pings a Server (home)
TabShop has to successfully check if the server is up and running. TabShop therefore requests a specific HTTP resource called home.
You simply save or deliver a file called home within the given URL that contains the string ‘true’ to indicate that the server is up and running.
Example: http://www.pocketvnc.com/tshop/home
2. TabShop Receiving Stock Lists from a Server (stock)
In order to receive a stock list from a central server, the TabShop client sends a HTTP GET request for the resource called stock:
/stock

The Server responds with following JSON Stock Message:
The semantics of this JSON request is to receive a list of stock with all necessary product attributes from a central server or service. The client receives this list of stock and adds all stock items, along with their defined stock amount to the local client database. This request is sent to the server in a periodic way in order to keep the local stock up to date with the central stock levels.
{“products”:[
{“id”:”72″,”category”:”\/Ice”,”title”:”StrawberryIce”,”price”:1.750,”costprice”:1,”discountid”:1,”description”:”Ice”,”attribute”:”0″,”stockqty”:10000,”taxid”:1}
,
{“id”:”56″,”category”:”\/Soft Drinks”,”title”:”CokeLight”,”price”:1.750,”costprice”:1,”discountid”:1,”description”:”Soft Drink”,”attribute”:”0″,”stockqty”:10000,”taxid”:1}
,

]}

Example: http://www.pocketvnc.com/tshop/stock

3. TabShop Receiving Tax List from a Server (tax)

In order to receive a list of defined taxes from a central server, the TabShop client sends a HTTP GET request for the resource called tax:
/tax

The Server responds with following JSON Tax Message:

{“taxes”:[{“id”:0,”percentage”:0,”name”:”-“},{“id”:1,”percentage”:0.1000,”name”:”VAT”}]}
Example: http://www.pocketvnc.com/tshop/tax

4. TabShop Receiving Discount List from a Server (discount)

In order to receive a list of defined discounts from a central server, the TabShop client sends a HTTP GET request for the resource called discount:

The Server responds with following JSON Discount Message:

{“discounts”:[{“id”:0,”percentage”:0,”name”:”-“},{“id”:1,”percentage”:0.100,”name”:”My”}]}

Example: http://www.pocketvnc.com/tshop/discount

5. TabShop sending Invoices to a Server (invoice)

TabShop PRO clients collect all invoices and invoice positions within their local SQLite database. A TabShop client periodically pushes the list of new invoices, along with all invoice positions to a specified central server. This message is implemented by using a similar HTTP POST message, as it was described before.

Here is an example for the invoices JSON invoice message sent from a TabShop client to a server:

{“invoices”:[{“total”:6.38,”id”:201409200100001,”positions”:[{“total”:3.19,”costPrice”:1.50,”tax”:0.29,”posTitle”:”Cheese Burger”,”qty”:1,”subtotal”:3.99,”productName”:”Cheese Burger”,”discount”:0.79,”productId”:”18″},{“total”:3.19,”costPrice”:1.50,”tax”:0.29,”posTitle”:”Big Burger”,”qty”:1,”subtotal”:3.99,”productName”:”Big Burger”,”discount”:0.79,”productId”:”24″}],”costPrice”:3,”tax”:0.58,”givenCash”:6.38,”returnedCash”:0,”checkoutType”:”0″,”customer”:{“email”:””,”address”:””,”name”:””},”date”:”1411219491162″,”checkoutStatus”:”10″,”discount”:1.58},{“total”:4.98,”id”:201409200100002,”positions”:[{“total”:2.99,”costPrice”:1,”tax”:0.271818,”posTitle”:”ApplePie”,”qty”:1,”subtotal”:2.99,”productName”:”ApplePie”,”discount”:0,”productId”:”3″},{“total”:1.99,”costPrice”:1,”tax”:0.180909,”posTitle”:”Jelly Babie”,”qty”:1,”subtotal”:1.99,”productName”:”Jelly Babie”,”discount”:0,”productId”:”4″}],”costPrice”:2,”tax”:0.45,”givenCash”:4.98,”returnedCash”:0,”checkoutType”:”0″,”customer”:{“email”:””,”address”:””,”name”:””},”date”:”1411219536041″,”checkoutStatus”:”10″,”discount”:0}]}


Leave a Reply

Your email address will not be published. Required fields are marked *