Store API¶
These endpoints will allow you to see the list of stores in Open Loyalty.
Get store details¶
To retrieve the details of a store, you need to call the /api/store/<store>
endpoint with the GET
method.
Definition¶
GET /api/store/<store>
Parameter | Parameter type | Description |
---|---|---|
Authorization | header | Token received during authentication |
<store> | query | Store Id |
Example¶
To see the details of the store with id store = cbc362ae-aa53-46d2-bc98-422ab249ac0b
, use the method below:
curl http://localhost:8181/api/store/cbc362ae-aa53-46d2-bc98-422ab249ac0b \
-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 may be different. Read more about Authorization here.
Note
Translatable fields (name, short description, etc.) are returned in the given locale.
Note
The cbc362ae-aa53-46d2-bc98-422ab249ac0b id is an example value. Your value may be different. Check the list of all admin users if you are not sure which id should be used.
Example Response¶
STATUS: 200 OK
Update a store¶
To update a store, you need to call the /api/store/<store>
endpoint with the PUT
method.
Definition¶
PUT /api/store/<store>
Parameter | Parameter type | Description |
---|---|---|
Authorization | header | Token received during authentication |
<store> | query | Store Id |
store[name] | query | Store name |
Example¶
To update a store with id store = cbc362ae-aa53-46d2-bc98-422ab249ac0b
, use the method below:
curl http://localhost:8181/api/store/cbc362ae-aa53-46d2-bc98-422ab249ac0b \
-X "PUT" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "store[name] = store_name" \
-d "store[active] = 0"
Note
The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value may be different. Read more about Authorization here.
Note
Translatable fields (name, short description etc.) are returned in the given locale.
Note
The cbc362ae-aa53-46d2-bc98-422ab249ac0b id is an example value. Your value may be different. Check the list of all admin users if you are not sure which id should be used.
Example Response¶
STATUS: 204 OK
Get a collection of stores¶
To retrieve a paginated list of stores, you need to call the /api/store
endpoint with the GET
method.
Definition¶
GET /api/store
Parameter | Parameter type | Description |
---|---|---|
Authorization | header | Token received during authentication |
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 |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
active | query | (optional) Filter by activity |
name | query | (optional) Filter by name |
To see the first page of all campaigns, use the method below:
Example¶
curl http://localhost:8181/api/store \
-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 may be different. Read more about Authorization here.
Example Response¶
STATUS: 200 OK
Create a new store¶
To create a new store, you need to call the /api/store
endpoint with the POST
method.
Definition¶
POST /api/store
Parameter | Parameter type | Description |
---|---|---|
Authorization | header | Token received during authentication |
store[code] | query | Store code |
store[name] | query | Store name |
store[currency] | query | Store currency |
store[active] | query | Store activity, possible values: active/inactive |
To create a new store, use the method below:
Example¶
curl http://localhost:8181/api/store \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "store[active] = 1" \
-d "store[name] = store_name" \
-d "store[currency] = EUR" \
-d "store[code] = store_code"
Note
The eyJhbGciOiJSUzI1NiIsInR5cCI6… authorization token is an example value. Your value may be different. Read more about Authorization here.
Example Response¶
STATUS: 200 OK