# Production group

Production groupings

::: info
Har bir javob umumiy konvertda qaytadi — `code`, `message`, `messages`, `status_code`, `time` — foydali yuk esa `data` ichida. Quyidagi jadvallar faqat `data` ichini tavsiflaydi.
:::

## POST /production-group/create

Create a new production group (hierarchical grouping of tech-maps).

**Kerakli ruxsat:** `production` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-group/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "tech_map",
  "name": "string",
  "organization_ids": [
    "string"
  ]
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-group/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "type": "tech_map",
    "name": "string",
    "organization_ids": [
      "string"
    ]
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/production-group/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "type": "tech_map",
        "name": "string",
        "organization_ids": [
            "string",
        ],
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "type": "tech_map",
  "name": "string",
  "organization_ids": [
    "string"
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-group/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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `type` | `string` | Ha | Category of tech-maps this group organises (tech_map or route_sheet). Mumkin qiymatlar: `tech_map`, `route_sheet` |
| `name` | `string` | Ha | Display name of the production group |
| `code` | `string` | Yo‘q | Optional short code for the group |
| `note` | `string` | Yo‘q | Optional free-text note |
| `parent_id` | `string` | Yo‘q | Parent production-group ObjectId for hierarchical grouping |
| `organization_ids` | `string[]` | Ha | Organization ObjectIds this group is scoped to |

```json
{
  "type": "tech_map",
  "name": "string",
  "code": "string",
  "note": "string",
  "parent_id": "string",
  "organization_ids": [
    "string"
  ]
}
```

**Javob**

| Maydon | Tur | Tavsif |
|---|---|---|
| `type` | `string` | Category of tech-maps this group organises (tech_map or route_sheet). Mumkin qiymatlar: `tech_map`, `route_sheet` |
| `name` | `string` | Display name of the production group |
| `code` | `string` | Optional short code for the group |
| `note` | `string` | Optional free-text note |
| `parent_id` | `string` | Parent production-group ObjectId for hierarchical grouping |
| `organization_ids` | `string[]` | Organization ObjectIds this group is scoped to |
| `_id` | `string` | Production group ObjectId |
| `is_deleted` | `boolean` | Soft-delete flag |
| `created_at` | `string (date-time)` | Creation timestamp (ISO 8601) |
| `updated_at` | `string (date-time)` | Last update timestamp (ISO 8601) |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "type": "tech_map",
    "name": "string",
    "code": "string",
    "note": "string",
    "parent_id": "string",
    "organization_ids": [
      "string"
    ],
    "_id": "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-group/get-by-id/{id}

Fetch a single production group by ObjectId.

**Kerakli ruxsat:** `production` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/production-group/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-group/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/production-group/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-group/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);
```

:::

**Yo‘l parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `id` | `string` | Ha | Production-group ObjectId |

**So‘rov tanasi**

So‘rov tanasi talab qilinmaydi.

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /production-group/create](#post-production-group-create).

## POST /production-group/get-paging

Paginated list of production groups, filterable by type and organization.

**Kerakli ruxsat:** `production` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-group/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20,
  "type": "tech_map"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-group/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20,
    "type": "tech_map"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/production-group/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
        "type": "tech_map",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20,
  "type": "tech_map"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-group/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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `page` | `number` | Ha | Standart: `1` |
| `limit` | `number` | Ha | Standart: `20` |
| `search` | `string` | Yo‘q | Filter by name or code |
| `type` | `string` | Ha | Filter by group type. Mumkin qiymatlar: `tech_map`, `route_sheet` |
| `organization_id` | `string` | Yo‘q | Filter by organization ObjectId |
| `parent_id` | `string` | Yo‘q | Filter by parent group ObjectId |
| `sort_by` | `string` | Yo‘q | Field name to sort by. |
| `asc` | `integer` | Yo‘q | Sort direction: `1` ascending, `-1` descending.. Mumkin qiymatlar: `-1`, `1` |

```json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "type": "tech_map",
  "organization_id": "string",
  "parent_id": "string",
  "sort_by": "string",
  "asc": -1
}
```

**Javob**

| Maydon | Tur | Tavsif |
|---|---|---|
| `total` | `number` |  |
| `list` | `object[]` |  |
| `list[].type` | `string` | Category of tech-maps this group organises (tech_map or route_sheet). Mumkin qiymatlar: `tech_map`, `route_sheet` |
| `list[].name` | `string` | Display name of the production group |
| `list[].code` | `string` | Optional short code for the group |
| `list[].note` | `string` | Optional free-text note |
| `list[].parent_id` | `string` | Parent production-group ObjectId for hierarchical grouping |
| `list[].organization_ids` | `string[]` | Organization ObjectIds this group is scoped to |
| `list[]._id` | `string` | Production group ObjectId |
| `list[].is_deleted` | `boolean` | Soft-delete flag |
| `list[].created_at` | `string (date-time)` | Creation timestamp (ISO 8601) |
| `list[].updated_at` | `string (date-time)` | Last update timestamp (ISO 8601) |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "type": "tech_map",
        "name": "string",
        "code": "string",
        "note": "string",
        "parent_id": "string",
        "organization_ids": [],
        "_id": "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-group/update/{id}

Update an existing production group.

**Kerakli ruxsat:** `production` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/production-group/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "tech_map",
  "name": "string",
  "organization_ids": [
    "string"
  ]
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-group/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "type": "tech_map",
    "name": "string",
    "organization_ids": [
      "string"
    ]
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/production-group/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "type": "tech_map",
        "name": "string",
        "organization_ids": [
            "string",
        ],
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "type": "tech_map",
  "name": "string",
  "organization_ids": [
    "string"
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-group/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);
```

:::

**Yo‘l parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `id` | `string` | Ha | Production-group ObjectId |

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `type` | `string` | Ha | Category of tech-maps this group organises. Mumkin qiymatlar: `tech_map`, `route_sheet` |
| `name` | `string` | Ha | Display name of the production group |
| `code` | `string` | Yo‘q | Optional short code for the group |
| `note` | `string` | Yo‘q | Optional free-text note |
| `parent_id` | `string` | Yo‘q | Parent production-group ObjectId for hierarchical grouping |
| `organization_ids` | `string[]` | Ha | Organization ObjectIds this group is scoped to |

```json
{
  "type": "tech_map",
  "name": "string",
  "code": "string",
  "note": "string",
  "parent_id": "string",
  "organization_ids": [
    "string"
  ]
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /production-group/create](#post-production-group-create).

## DELETE /production-group/delete/{id}

Soft-delete a production group by ObjectId.

**Kerakli ruxsat:** `production` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/production-group/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-group/delete/6712f0a9c4d1e87b3a0f9911', {
  method: 'DELETE',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/production-group/delete/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/production-group/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);
```

:::

**Yo‘l parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `id` | `string` | Ha | Production-group ObjectId |

**So‘rov tanasi**

So‘rov tanasi talab qilinmaydi.

**Javob**

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

---

*Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.*
