Skip to main content

Retail Stores

Embodies the actual retail locations where the product is sold.

Users can add/delete/update stores in Omnitron with GET, POST, PATCH, PUT and DELETE requests via api/v1/retail_stores/ endpoint.

GET Retail Stores

Path: api/v1/retail_stores/

Path: api/v1/retail_stores/<pk>/

When a GET request is made directly from retail_stores/, users can get all stores. If a user sends a GET request like retail_stores/1/ they will get the store with ID value 1 (instead of 1 send the id you need). Associated data has only an ID value.

{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"name": "Shop 1",
"township": 1,
"district": 5,
...

Path: api/v1/retail_stores/detailed/

Path: api/v1/retail_stores/<pk>/detailed/

Sending a request to the detailed/ endpoint will result in a list of properties of the related data.

{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"name": "Shop 1",
"township": {
"pk": 1,
"is_active": true,
"name": "Test Township 1",
"city": {
"pk": 1,
...

POST Create a Retail Store

Parameters for creating a retail store are displayed in the table below.

ParameterData TypeInRequiredDescription
authorizationstringheaderYESThe API key of the customer account
namestringbodyYESName of the store
addressstringbodyYESAddress details
townshipIDbodyYESTownship ID value
phone_numberstringbodyYESPhone number
channelsID ListbodyYESSales channel ID values
store_typeID or nullbodyYESStore type ID value
fax_phone_numberstringbodyYESFax phone number
click_and_collectBooleanbodyYESPermission for getting products from Store
store_hoursListbodyYESWork hours
is_activeBooleanbodyYESActivity status
districtIDbodyDistrict ID value
latitudenumberbodyLatitude
longitudenumberbodyLongitude
kapida_enabledbooleanbodyA field specific to a project
fast_deliverybooleanbodyStatus of fast delivery
erp_codestringbodyStore erp code

When a post request is made to the retail_stores/ endpoint, such as the example data below, the creation process takes place.

Path: api/v1/retail_stores/

Request

{

"name":"test-u-1",
"address":"test address text",
"township":1,
"phone_number":"02129998877",
"channels":[1],
"is_active":true,
"store_type": null,
"fax_phone_number": "02129998877",
"click_and_collect": false,
"store_hours": [
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"]
]
}

Response

{
"pk": 11,
"name": "test-u-1",
"township": 1,
"district": null,
"address": "test address text",
"phone_number": "02129998877",
"fax_phone_number": "02129998877",
"image": null,
"store_hours": [
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
],
[
"09:00:00",
"19:00:00"
]
],
"latitude": null,
"longitude": null,
"is_active": true,
"click_and_collect": false,
"store_type": null,
"kapida_enabled": false,
"fast_delivery": false,
"config": {},
"group": null,
"sort_order": null,
"channels": [
1
],
"erp_code": null,
"modified_date": "2022-12-23T09:33:42.986845Z",
"created_date": "2022-12-23T09:33:42.986832Z"
}

Access the data below for the District, Township, Channels and Store Type that you will need in order to use the above request.

District: Get it by sending a GET request to the api/v1/districts/ endpoint.

Township: Get it by sending a GET request to the api/v1/townships/ endpoint.

Channels: Get it by sending a GET request to the api/v1/channels/ endpoint.

Store Type: : Get it by sending a GET request to the api/v1/retailstore_type/ endpoint.

PATCH Modify an Existing Retail Store

When a patch request, such as the sample data below, is sent to the retail_stores/ID/ endpoint, the update process will be completed. Update the store whose ID value is 1 (replace 1 with the ID value you need).

Path: api/v1/retail_stores/{pk}/

{
"name": "New Test Retail Store", # Retail Store Name
"township": 453, # Township ID Value
"address": "Test district Test street, Test building", # Address Detail
"phone_number": "02129998811", # Phone Number
"district": 32445, # District ID Value
}

Access the data below for the District, Township, Channels and Store Type that you will need to use the above request.

District: Get it by sending a GET request to the api/v1/districts/ endpoint.

Township: Get it by sending a GET request to the api/v1/townships/ endpoint.

Channels: Get it by sending a GET request to the api/v1/channels/ endpoint.

Store Type: Get it by sending a GET request to the api/v1/retailstore_type/ endpoint

PUT Modify an existing Retail Store

When a PUT request is sent like the example data below to the retail_stores/ID/ endpoint, the entire field will be updated. Update the store whose ID value is 1 (replace 1 with the ID value you need).

Path: api/v1/retail_stores/{pk}/

{
"name": "Test Retail Store", # Retail Store Name
"township": 454, # Township ID Value
"address": "Test district test street", # Address Detail
"phone_number": "02129998877", # Phone Number
"fax_phone_number": null, # Fax Phone Number
"is_active": true, # Status of Activity
"click_and_collect": false, # Permission for getting products from Store
"store_type": null, # Store Type ID Value
"erp_code": "test_retail_store", # ERP Code Value
"district": 35485, # District ID Value
"channels": [1], # Sale Channels ID Values
"store_hours": [ # Work Hours
["09:00", "18:00"],
["09:00", "18:00"],
["09:00", "18:00"],
["09:00", "18:00"],
["09:00", "18:00"],
["09:00", "12:00"],
["10:00", "12:00"]
]
}

Access the data below for the District, Township, Channels and Store Type that you will need to use the above request.

District: Get it by sending a GET request to the api/v1/districts/ endpoint.

Township: Get it by sending a GET request to the api/v1/townships/ endpoint.

Channels: Get it by sending a GET request to the api/v1/channels/ endpoint.

Store Type: Get it by sending a GET request to the api/v1/retailstore_type/ endpoint.

DELETE Retail Store

When a delete request is sent like the example data below to the retail_stores/ID/ endpoint the deletion will be completed. Delete the store with ID value of 1 (substitute with ID value you need). This will update the is_active value to False, but won’t delete the relevant model.

Path: api/v1/retail_stores/{pk}/

Special Endpoints


add_districts

Provide a new neighborhood definition to the config value of the store by sending a POST request to the /api/v1/retail_stores/{retail_stores_id}/add_districts/ endpoint.

POST Add Districts to a Retail Store

Path: /api/v1/retail_stores/{retail_stores_id}/add_districts/

{
"districts": [35482, 35411, 35213], # defining multiple district values
}


remove_districts

Send a POST request to /api/v1/retail_stores/{retail_stores_id}/remove_districts/endpoint so that a new neighborhood is deleted in the config value of the store.

POST Remove Districts in a Retail Store

Path: /api/v1/retail_stores/{retail_stores_id}/remove_districts/

{
"districts": [35482, 35411], # removing multiple district values
}