Division

Division is a store which owns the brand. There are two types of division such as main and sub

The users of main divisions are able to perform actions for both their and its sub-divisions.

  1. create, update, list, approve, cancel or reject quotation

  2. create, list quotation comment

  3. create order from a quotation

  4. create, update, list, delete quotation discount

The users of sub-divisions are able to perform their quotations only.

  1. create, list, approve, cancel or reject, approve pending quotation

A division has a monthly limit field. If this limit is exceeded, the division cannot create new quotations.

When the main division creates a new quotation, the total is calculated by adding the total amount of its quotations, the total amount of quotations from its sub-divisions, and the amount of the new quotation being created. If this cumulative total exceeds the main division's monthly limit, the new quotation cannot be created.

When a sub-division creates a new quotation, the total is calculated by adding the total amount of its quotations and the amount of the new quotation being created.

When a division is created country_id, city_id, township_id, district_id, phone_number, address should be matched with Commerce data otherwise exception occurs when creating an order.

List My Divisions

Example Request

curl --location {host}/api/v1/my-divisions/' \
--header 'Authorization: Token {Token}'

Example Response (200 OK)

List All My Divisions

This method allows users to retrieve a list of their divisions. Depending on the association, it retrieves either all child divisions linked to the main division or the associated division along with its parent division.

Example Request

Example Response (200 OK)

List Divisions

Example Request

Example Response (200 OK)

You can also use the following filters to list divisions for both above API.

  • name,

  • erp_code with case-insensitive,

  • has_parent with is null operator,

  • current_balance_min,

  • current_balance_max,

  • current_balance_last_update_before,

  • current_balance_last_update_after,

  • parent,

  • division_type,

  • city_id,

  • country_id phone_number,

  • is_active,

  • user

Example Request

Example Response (200 OK)

Get Division

Example Request

Example Response (200 OK)

Create Main Division

Example Request

Example Response (200 OK)

Example Response (400 Bad Request)

It occurs when the posted parent is not a main division:

Example Response (400 Bad Request)

It occurs when sending parent property with main division type

Create Sub-Division

Example Request

Example Response (200 OK)

Update Division

Example Request

Example Response (200 OK)

Example Response (400 Bad Request)

It occurs when the posted parent is not a main division:

Example Response (400 Bad Request)

It occurs when sending parent property with main division type:

Deactivate Division

When a division is deactivated its users and Commerce users are deactivated as well. Users cannot perform actions when they are deactivated.

Example Request

Example Response (200 OK)

Empty body.

Activate Division

When a division is activated its users are activated as well.

Example Request

Example Response (200 OK)

Empty body.

Export My Divisions

Exports divisions as a file. Returns a cache key to track the export status.

Request Parameters

Parameter
Description

fields

Specifies the fields to be included in the export file. Available fields: name, division_type, erp_code, is_active, country_id, city_id, township_id, district_id, address, phone_number, fax_number, latitude, longitude, monthly_order_limit, current_balance, current_balance_last_update, extra_data

format

Specifies the file format for the export. Acceptable values are csv and xls. The default is xls.

status_cache_key

A query parameter to track the status of the file export using the cache key returned from the initial request.

Example Request

Example Response (200 OK)

Export File Status

Checks the status of an export file using the cache key obtained from the export request. Provides information on whether the file is ready for download.

Example Request

Example Response

Response Parameters

Field
Description

is_ready

Indicates whether the file is ready for download (true or false).

url

The URL to download the exported file once it is ready.

status

Provides the current status of the export process (e.g., waiting, completed).

Last updated

Was this helpful?