Skip to content
Markdown

Production order ​

Production orders

INFO

Каждый ответ приходит в общем конверте — code, message, messages, status_code, time — а полезная нагрузка лежит в data. Таблицы ниже описывают содержимое data.

POST /production-order/create ​

Create a new production order with its line items.

Нужное разрешение: production · как работают разрешения

Пример запроса

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-order/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-order/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "string",
    "date": "2025-05-01T12:00:00Z",
    "items": [
      {
        "product_id": "string",
        "tech_map_id": "string",
        "amount": 0
      }
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/production-order/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
        "date": "2025-05-01T12:00:00Z",
        "items": [
            {
                "product_id": "string",
                "tech_map_id": "string",
                "amount": 0,
            },
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-order/create');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId the production order belongs to
datestring (date-time)ДаProduction order date (ISO 8601)
codestringНетOptional human-readable order code
notestringНетOptional free-text note
itemsobject[]ДаLine items — each references a product and a tech-map
items[].product_idstringДаProduct ObjectId to be produced
items[].tech_map_idstringДаTechnical map (recipe/BOM) ObjectId to use
items[].amountnumberДаPlanned production quantity
json
{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "code": "string",
  "note": "string",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}

Ответ

ПолеТипОписание
organization_idstringOrganization ObjectId the production order belongs to
datestring (date-time)Production order date (ISO 8601)
codestringOptional human-readable order code
notestringOptional free-text note
itemsobject[]Line items — each references a product and a tech-map
items[].product_idstringProduct ObjectId to be produced
items[].tech_map_idstringTechnical map (recipe/BOM) ObjectId to use
items[].amountnumberPlanned production quantity
_idstringProduction order ObjectId
statusstringCurrent production order state
is_deletedbooleanSoft-delete flag
created_atstring (date-time)Creation timestamp (ISO 8601)
updated_atstring (date-time)Last update timestamp (ISO 8601)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "organization_id": "string",
    "date": "2025-05-01T12:00:00Z",
    "code": "string",
    "note": "string",
    "items": [
      {
        "product_id": "string",
        "tech_map_id": "string",
        "amount": 0
      }
    ],
    "_id": "string",
    "status": "string",
    "is_deleted": false,
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /production-order/get-by-id/{id} ​

Fetch a single production order by ObjectId.

Нужное разрешение: production · как работают разрешения

Пример запроса

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/production-order/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-order/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/production-order/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-order/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Параметры пути

ПараметрТипОбязательноОписание
idstringДаProduction-order ObjectId

Тело запроса

Тело запроса не требуется.

Ответ

Структура ответа совпадает с POST /production-order/create.

POST /production-order/get-paging ​

Paginated list of production orders, filterable by organization.

Нужное разрешение: production · как работают разрешения

Пример запроса

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-order/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-order/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/production-order/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-order/get-paging');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Тело запроса

ПолеТипОбязательноОписание
pagenumberДаПо умолчанию: 1
limitnumberДаПо умолчанию: 20
organization_idstringНетFilter by organization ObjectId
searchstringНетFree-text search.
updated_atstring (date-time)НетOnly records updated at or after this time.
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "search": "string",
  "updated_at": "2025-05-01T12:00:00Z"
}

Ответ

ПолеТипОписание
totalnumber
listobject[]
list[].organization_idstringOrganization ObjectId the production order belongs to
list[].datestring (date-time)Production order date (ISO 8601)
list[].codestringOptional human-readable order code
list[].notestringOptional free-text note
list[].itemsobject[]Line items — each references a product and a tech-map
list[].items[].product_idstringProduct ObjectId to be produced
list[].items[].tech_map_idstringTechnical map (recipe/BOM) ObjectId to use
list[].items[].amountnumberPlanned production quantity
list[]._idstringProduction order ObjectId
list[].statusstringCurrent production order state
list[].is_deletedbooleanSoft-delete flag
list[].created_atstring (date-time)Creation timestamp (ISO 8601)
list[].updated_atstring (date-time)Last update timestamp (ISO 8601)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "organization_id": "string",
        "date": "2025-05-01T12:00:00Z",
        "code": "string",
        "note": "string",
        "items": [],
        "_id": "string",
        "status": "string",
        "is_deleted": false,
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /production-order/update/{id} ​

Update an existing production order and its line items.

Нужное разрешение: production · как работают разрешения

Пример запроса

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/production-order/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-order/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "string",
    "date": "2025-05-01T12:00:00Z",
    "items": [
      {
        "product_id": "string",
        "tech_map_id": "string",
        "amount": 0
      }
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/production-order/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
        "date": "2025-05-01T12:00:00Z",
        "items": [
            {
                "product_id": "string",
                "tech_map_id": "string",
                "amount": 0,
            },
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-order/update/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Параметры пути

ПараметрТипОбязательноОписание
idstringДаProduction-order ObjectId

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId the production order belongs to
datestring (date-time)ДаProduction order date (ISO 8601)
codestringНетOptional human-readable order code
notestringНетOptional free-text note
itemsobject[]ДаReplacement line items for the order
items[].product_idstringДаProduct ObjectId to be produced
items[].tech_map_idstringДаTechnical map (recipe/BOM) ObjectId to use
items[].amountnumberДаPlanned production quantity
json
{
  "organization_id": "string",
  "date": "2025-05-01T12:00:00Z",
  "code": "string",
  "note": "string",
  "items": [
    {
      "product_id": "string",
      "tech_map_id": "string",
      "amount": 0
    }
  ]
}

Ответ

Структура ответа совпадает с POST /production-order/create.

DELETE /production-order/delete/{id} ​

Soft-delete a production order by ObjectId.

Нужное разрешение: production · как работают разрешения

Приложению, которое отменяет документ, стоит запросить и production_order_cancel.

Пример запроса

bash
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/production-order/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-order/delete/6712f0a9c4d1e87b3a0f9911', {
  method: 'DELETE',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/production-order/delete/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-order/delete/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Параметры пути

ПараметрТипОбязательноОписание
idstringДаProduction-order ObjectId

Тело запроса

Тело запроса не требуется.

Ответ

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

Эта страница сгенерирована из спецификации OpenAPI.

Bito 2.0 Integration API