OfficeGest
Stocks/Articles/{article}/Kits/Compose

Compose kit units

Composes kit units from its components: one stock exit (SR) per component warehouse and one stock entry of the kit with the movement type set in STOCK_TipoMovEntradaComporKit (ERC by default). The kit is valued at the sum of quantity x average cost of its components. All movements are created in one transaction.

POST
/stocks/articles/{article}/kits/compose
AuthorizationBearer <token>

In: header

Path Parameters

articlestring
quantitynumber

Kit units to compose. Must be greater than 0.

Range0 < value
warehouse_idinteger

Warehouse that receives the composed kits.

lot?string

Kit lot. Required when the kit uses lots; the lot must exist.

serial_numbers?array<unknown>

Kit serial numbers. Required when the kit uses serial numbers, exactly quantity values not in stock yet.

componentsarray<object>

One entry per kit component, covering every component of the kit.

components.*.article_idstring

Component article code.

components.*.warehouse_idinteger

Warehouse the component leaves from.

components.*.lot?string

Component lot with stock in that warehouse. Required when the component uses lots.

components.*.serial_numbers?array<unknown>

Component serial numbers in that warehouse. Required for serial components, quantity x quantity per kit.

Response Body

curl -X POST "https://og-tenant1.test:8003/api/v2/stocks/articles/string/kits/compose" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 2,
    "warehouse_id": 1,
    "components": [
      {
        "article_id": "ART001",
        "warehouse_id": 1
      }
    ],
    "components.*.article_id": "ART001",
    "components.*.warehouse_id": 1
  }'
Empty
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}
{
  "data": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "errors": {
      "email": [
        "The email field is required."
      ]
    }
  },
  "meta": {
    "trace_id": "9f86d081884c7d659a2feaa0c55ad01568f3a1c2b4d5e"
  }
}