Working with Parts

Create a new part

Create a new part record in Anvyl by making an HTTP POST request to the “​​Create new part record” endpoint.

The request should contain at least a “name”, along with “sku” and “description” as optional; to successfully create a new Part record in Anvyl. "sku" is not required but it is recommended to populate this field for customized SKU/Part Number. If “sku” were to be blank, the system would auto-generate it.

An example request looks like the following:
POST /parts

{
   "part": {
       "name": "100ml Bottle",
       "sku" : "B100",
       "description": "A 100ml bottle."
   }
}

Update tags & identifiers

Update the tags and identifiers of an existing part in Anvyl by making an HTTP PATCH request to “​​Update a specific single part” endpoint.

The “tags” should be enclosed within an array of strings, and “part_identifiers” should consist of an array of objects whose “label” indicates the identifier name and “value” indicates the value of the respective identifier. The following show the existing (preset) identifier “label” equivalence between the Anvyl UI and API:

UI FieldAPI Field
HTS CodeHTS_CODE
UPCUPC
ISBNISBN
ASINASIN

Custom identifiers are available, which could be created either via UI or API. The request, for creating a new custom identifier via API, should contain “label”, “value”, and “field_type”. Otherwise, updating an existing custom identifier only requires “label” and “value”.

An example request looks like the following:
PATCH /parts/{part_id}

{
   "part": {
       "tags": [
           "tag_1",
           "tag_2"
       ],
       "part_identifiers": [
           {
               "label": "HTS_CODE",
               "value": "123456"
           }
       ]
   }
}

Add part and supplier link

Add a supplier link to an existing part in Anvyl by making an HTTP PATCH request to “​​Update a specific single part” endpoint.

Anvyl allows establishing a part - supplier relationship, where a part record could be linked to many suppliers with special information, such as "min_order_qty", "lead_time_days", and "supplier_part_number".

An example request looks like the following:
PATCH /parts/{part_id}

{
   "part": {
       "suppliers": [
           {
               "quantity_details": [
                   {
                       "unit_price_micros": 2000000,
                       "currency": "USD",
                       "unit_of_measure": "units",
                       "min_order_qty": 1,
                       "lead_time_days": 10
                   }
               ],
               "id": 33659,
               "supplier_part_number": "TB100",
               "notes": "SupplierPartTest"
           }
       ]
   }
}

Create an assembly item with its components

Create an assembly item in Anvyl by making an HTTP POST request to the “​​Create new part record” endpoint followed by the “Bulk import parts” endpoint for its components.

The key to indicate a part record as a component (a part of an assembly item) is in the “parents” field, which the assembly item record “id” would need to be referenced properly. In addition, updating an existing part to be a component to an assembly item is possible by calling “​​Update a specific single part” endpoint.

🚧

Please note that updating an existing component - “parents” object would need to reference the existing “parents[id]” reference, otherwise, the existing/old “parents[id]” reference would get overwritten/deleted.

An example request looks like the following:
[Assembly Item]
POST /parts

{
    "part": {
         "name": "Shampoo",
         "sku": "S100",
         "description": "Shampoo bottle assembly."
    }
}

[Components]
POST /bulk/parts

{
    "parts": [
         {
              "parents": [
                   {
                        "id": 2137735
                   }
              ],
              "name": "250ml Shampoo Bottle",
              "sku": "B250ST"
         },
         {
              "parents": [
                   {
                        "id": 2137735
                   }
              ],
              "name": "Shampoo Fills",
              "sku": "F250ST"
         }
    ]
}

What’s Next