POS API

These endpoints will allow you to see the list of POS taken in Open Loyalty.

Get the complete list of POS

To retrieve a complete list of POS, you need to call the /api/<storeCode>/pos endpoint with the GET method.

Definition

GET /api/<storeCode>/pos
Parameter Parameter type Description
Authorization header Token received during authentication
<storeCode> query Code of the store to get POS from.
page query (optional) Start from page, by default 1
perPage query (optional) Number of items to display per page, by default = 10
sort query (optional) Sort by column name, by default = name
direction query (optional) Direction of sorting [ASC, DESC], by default = ASC

Example

curl http://localhost:8181/api/DEFAULT/pos \
    -X "GET" \
    -H "Accept: application/json" \
    -H "Content-type: application/x-www-form-urlencoded" \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."

Note

The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value can be different. Read more about Authorization here.

Example Response

STATUS: 200 OK
{
  "pos": [
    {
      "posId": "00000000-0000-474c-1111-b0dd880c07e2",
      "name": "test2",
      "identifier": "pos1",
      "description": "test",
      "location": {
        "street": "Dmowskiego",
        "address1": "21",
        "province": "Dolnośląskie",
        "city": "Wrocław",
        "postal": "50-300",
        "country": "PL",
        "geoPoint": {
          "lat": "51.1170364",
          "long": "17.0203959"
        }
      },
      "transactionsAmount": 133.4,
      "transactionsCount": 3,
      "currency": "eur"
    },
    {
      "posId": "00000000-0000-474c-1111-b0dd880c07e3",
      "name": "test1",
      "identifier": "pos2",
      "description": "test",
      "location": {
        "street": "Dmowskiego",
        "address1": "21",
        "province": "Dolnośląskie",
        "city": "Warszawa",
        "postal": "50-300",
        "country": "PL",
        "geoPoint": {
          "lat": "51.1170364",
          "long": "17.0203959"
        }
      },
      "transactionsAmount": 0,
      "transactionsCount": 0,
      "currency": "eur"
    }
  ],
  "total": 2
}

Create a new POS

To create a new POS, you need to call the /api/<storeCode>/pos endpoint with the POST method.

Definition

POST /api/<storeCode>/pos
Parameter Parameter type Description
Authorization header Token received during authentication
<storeCode> query Code of the store to create POS in.
pos[name] request POS name
pos[identifier] request POS Identifier
pos[description] request (optional) A short description
pos[location][street] request Street for POS Location
pos[location][address1] request Address1 for POS Location
pos[location][address2] request (optional) Address2 for POS Location
pos[location][postal] request Post code for POS Location
pos[location][city] request City for POS Location
pos[location][province] request Province for POS Location
pos[location][country] request Country for POS Location
pos[location][lat] request (optional) Latitude for POS Location
pos[location][long] request (optional) Longitude for POS Location

Example

curl http://localhost:8181/api/DEFAULT/pos \
     -X "POST" \
     -H "Accept:\ application/json" \
     -H "Content-type:\ application/x-www-form-urlencoded" \
     -H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
     -d "pos[name]=testname" \
     -d "pos[identifier]=testid" \
     -d "pos[description]=testdescription" \
     -d "pos[location][street]=polna" \
     -d "pos[location][address1]=24" \
     -d "pos[location][address2]=5" \
     -d "pos[location][postal]=98-765" \
     -d "pos[location][city]=Wroclaw" \
     -d "pos[location][province]=WroclawProvince" \
     -d "pos[location][country]=Poland" \
     -d "pos[location][lat]=latitude" \
     -d "pos[location][long]=longitude"

Note

The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value can be different. Read more about Authorization here.

Example Response

STATUS: 200 OK
{
  "posId": "fe28cf15-9c95-46ee-bc7a-c40b2f2f0d40"
}

Get POS details

To retrieve the POS details, you need to call the /api/<storeCode>/pos/identifier/<pos> endpoint with the GET method.

Definition

GET /api/<storeCode>/pos/identifier/<pos>
Parameter Parameter type Description
Authorization header Token received during authentication
<storeCode> query Code of the store to get POS from.
<pos> query POS identifier

Example

To see the details of the POS with id pos = testid9, use the method below:

curl http://localhost:8181/api/DEFAULT/pos/identifier/testid9 \
    -X "GET" \
    -H "Accept: application/json" \
    -H "Content-type: application/x-www-form-urlencoded" \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."

Note

The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value can be different. Read more about Authorization here.

Example Response

STATUS: 200 OK
{
  "posId": "6235a987-1639-420f-8001-537f0f2eeafa",
  "name": "test9",
  "identifier": "testid9",
  "description": "test9description",
  "location": {
    "street": "topolowa",
    "address1": "9",
    "address2": "1",
    "province": "Warsaw",
    "city": "Warsaw",
    "postal": "99-999",
    "country": "PL"
  },
  "transactionsAmount": 0,
  "transactionsCount": 0,
  "currency": "eur"
}

Get POS details

To retrieve the POS details, you need to call the /api/<storeCode>/pos/<pos> endpoint with the GET method.

Definition

GET /api/<storeCode>/pos/<pos>
Parameter Parameter type Description
Authorization header Token received during authentication
<storeCode> query Code of the store to get POS from.
<pos> query POS identifier

Example

To see the details of the POS with id pos = 00000000-0000-474c-1111-b0dd880c07e3, use the method below:

curl http://localhost:8181/api/DEFAULT/pos/00000000-0000-474c-1111-b0dd880c07e3 \
    -X "GET" \
    -H "Accept: application/json" \
    -H "Content-type: application/x-www-form-urlencoded" \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."

Note

The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value can be different. Read more about Authorization here.

Example Response

STATUS: 200 OK
{
  "posId": "00000000-0000-474c-1111-b0dd880c07e3",
  "name": "test1",
  "identifier": "pos2",
  "description": "test",
  "location": {
    "street": "Dmowskiego",
    "address1": "21",
    "province": "Dolnośląskie",
    "city": "Warszawa",
    "postal": "50-300",
    "country": "PL",
    "geoPoint": {
      "lat": "51.1170364",
      "long": "17.0203959"
    }
  },
  "transactionsAmount": 0,
  "transactionsCount": 0,
  "currency": "eur"
}

Update POS data

To update the POS data, you need to call the /api/<storeCode>/pos/<pos> endpoint with the PUT method.

Definition

PUT /api/<storeCode>/pos/<pos>
Parameter Parameter type Description
Authorization header Token received during authentication
<storeCode> query Code of the store to update the POS in.
<pos> query POS ID
pos[name] request POS name
pos[identifier] request POS Identifier
pos[description] request (optional) A short description
pos[location][street] request Street for POS Location
pos[location][address1] request Building name for POS Location
pos[location][address2] request (optional) Flat/Unit name for POS Location
pos[location][postal] request Post code for POS Location
pos[location][city] request City for POS Location
pos[location][province] request Province for POS Location
pos[location][country] request Country for POS Location
pos[location][lat] request (optional) Latitude for POS Location
pos[location][long] request (optional) Longitude for POS Location

Example

To fully update the POS with id = 857b2a26-b490-4356-8828-e138deaf7912, use the method below:

curl http://localhost:8181/api/DEFAULT/pos/857b2a26-b490-4356-8828-e138deaf7912 \
    -X "PUT" \
    -H "Accept: application/json" \
    -H "Content-type: application/x-www-form-urlencoded" \
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
    -d "pos[name]=test8" \
    -d "pos[identifier]=testid8" \
    -d "pos[description]=test8description" \
    -d "pos[location][street]=kwiatowa" \
    -d "pos[location][address1]=66" \
    -d "pos[location][address2]=33" \
    -d "pos[location][postal]=666-333" \
    -d "pos[location][city]=Honolulu" \
    -d "pos[location][province]=HonululuProvince" \
    -d "pos[location][country]=USA" \
    -d "pos[location][lat]=latitude8" \
    -d "pos[location][long]=longitude8"

Note

The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value can be different. Read more about Authorization here.

Example Response

STATUS: 200 OK
{
  "posId": "857b2a26-b490-4356-8828-e138deaf7912"
}