Skip to main content
POST
/
components
Add a new component
curl --request POST \
  --url https://api.rechain.co/public/v1/components \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'name=Component Name' \
  --form weight=1.5 \
  --form code=COMP1234 \
  --form companyId=123e4567-e89b-12d3-a456-426614174000 \
  --form componentCategoryId=123e4567-e89b-12d3-a456-426614174000 \
  --form library=true \
  --form supplierId=6 \
  --form price=29.99 \
  --form colorId=123e4567-e89b-12d3-a456-426614174000 \
  --form printId=123e4567-e89b-12d3-a456-426614174000 \
  --form unitId=123e4567-e89b-12d3-a456-426614174000 \
  --form componentColorId=123e4567-e89b-12d3-a456-426614174000 \
  --form placement=Front \
  --form 'priceEvolution={
  "1724855528": "4.38"
}' \
  --form photo='@example-file'
{
  "name": "Component Name",
  "weight": "1.5",
  "code": "COMP1234",
  "companyId": "123e4567-e89b-12d3-a456-426614174000",
  "componentCategoryId": "123e4567-e89b-12d3-a456-426614174000",
  "library": true,
  "supplierId": 6,
  "price": 29.99,
  "colorId": "123e4567-e89b-12d3-a456-426614174000",
  "unitId": "123e4567-e89b-12d3-a456-426614174000",
  "componentColorId": "123e4567-e89b-12d3-a456-426614174000",
  "placement": "Front",
  "priceEvolution": {
    "1724855528": "4.38"
  },
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "createdAt": "2024-09-03T10:00:00Z",
  "composition": "50% Cotton, 50% Polyester",
  "photoUrl": "https://example.com/photo.jpg",
  "componentCategoryName": "Category Name",
  "variantComponents": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "componentVariants": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "colorId": "123e4567-e89b-12d3-a456-426614174000",
      "colorGroupId": "123e4567-e89b-12d3-a456-426614174000",
      "uniqAssociationsIds": "123e4567-e89b-12d3-a456-426614174000_123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "componentValues": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "componentFieldId": "123e4567-e89b-12d3-a456-426614174000",
      "componentFieldUnit": "kg",
      "content": "Content Example"
    }
  ],
  "componentColors": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "color": {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "name": "Red",
        "hex": "#FF5733",
        "yama": "Yama Name",
        "image": "https://example.com/color.jpg",
        "pantone": "Pantone 1234"
      }
    }
  ],
  "colorGroups": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Color Group Name"
    }
  ],
  "componentVariantTypeOptions": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "content": "Option Content",
      "componentId": "123e4567-e89b-12d3-a456-426614174000",
      "componentVariantTypeId": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "unit": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Unit Name"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data

Create a new component

name
string
required
Example:

"Component Name"

code
string
required
Example:

"COMP1234"

companyId
string
required
Example:

"123e4567-e89b-12d3-a456-426614174000"

componentCategoryId
string
required
Example:

"123e4567-e89b-12d3-a456-426614174000"

weight
string
Example:

"1.5"

library
boolean
Example:

true

supplierId
integer
Example:

6

price
number
Example:

29.99

colorId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

printId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

unitId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

componentColorId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

placement
string
Example:

"Front"

priceEvolution
object
Example:
{ "1724855528": "4.38" }
photo
file

The photo file to upload

Response

Successful operation

name
string
required
Example:

"Component Name"

code
string
required
Example:

"COMP1234"

companyId
string
required
Example:

"123e4567-e89b-12d3-a456-426614174000"

componentCategoryId
string
required
Example:

"123e4567-e89b-12d3-a456-426614174000"

id
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

createdAt
string<date-time>
Example:

"2024-09-03T10:00:00Z"

composition
string
Example:

"50% Cotton, 50% Polyester"

photoUrl
string<uri>
Example:

"https://example.com/photo.jpg"

componentCategoryName
string
Example:

"Category Name"

variantComponents
object[]
componentVariants
object[]
componentValues
object[]
componentColors
object[]
colorGroups
object[]
componentVariantTypeOptions
object[]
unit
object
weight
string
Example:

"1.5"

library
boolean
Example:

true

supplierId
integer
Example:

6

price
number
Example:

29.99

colorId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

unitId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

componentColorId
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

placement
string
Example:

"Front"

priceEvolution
object
Example:
{ "1724855528": "4.38" }