1. Resource Central
  2. arrow-right
  3. Material Codes

Material Codes

Alternate lookup codes/part numbers for materials. Material codes must be unique to other codes and material names.

Attributes

  • name string

    The alternate lookup code. Material codes must be unique to other codes and material names.

  • id uuid

    The ID of the code.

  • materialId uuid

    The ID of the material.

  • packSize integer

    Deprecated.

Endpoints

List Material Codes /api/material_codes
get

Get a list of material codes from the PPG database. View the guide on adding filters to List API calls.

Body Parameters

  • name string

    Only return material codes that have the given name.

  • materialId uuid

    Return codes for the material with this ID.

  • packSize integer

    Deprecated.

  • countOnly boolean

    When "true", will only return a count of the amount of items in the query.

    Default value:

    false

  • limit integer

    A limit on the number of objects to be returned.

    Default value:

    1000

  • page integer

    Page numbering is zero-based and uses the value of the "limit" argument. (For example, if limit=20, then page=0 will display the hits from 1 to 20.)

  • orderBy string, array

    Order the response by the selected field. Multiple values can be passed, separated by a comma.

Request with curl
curl "http://[subdomain.itempath.com or IP]/api/material_codes" \ -X get \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]" -d '{ }'
Example Response
{
    "material_codes": [
        {
            "id": "FBB20FCE-6CBC-48EB-8879-914865BA116A",
            "packSize": null,
            "name": "SampleCode",
            "materialId": "EBD286D1-4D5A-41C3-B24A-E62FC1008E57"
        },
        {
            "id": "DA38F9D1-5144-4C20-AF12-735E88A7332E",
            "packSize": null,
            "name": "SampleCode2",
            "materialId": "EBD286D1-4D5A-41C3-B24A-E62FC1008E57"
        }
    ]
}
Create Material Code /api/material_codes
post

Add a new material code to a material in the PPG database and return a response. Material codes must be unique to other codes and material names.

Body Parameters

  • name string
    REQUIRED

    The material code. Must be unique to other codes and material names.

  • materialId uuid
    REQUIRED

    The ID of the material this code belongs to.

  • packSize integer

    Deprecated.

Request with curl
curl "http://[subdomain.itempath.com or IP]/api/material_codes" \ -X post \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]" \
-d '{
    "materialId": "EBD286D1-4D5A-41C3-B24A-E62FC1008E57",
    "name": "SampleCode"
}'
Example Response
{
    "material_code": [
        {
            "id": "FBB20FCE-6CBC-48EB-8879-914865BA116A",
            "packSize": null,
            "name": "SampleCode",
            "materialId": "EBD286D1-4D5A-41C3-B24A-E62FC1008E57"
        }
    ]
}
Show Material Code /api/material_codes/[id]
get

Get a specific material code by its ID from the PPG database and return a JSON response. The order will be pulled from the Material table.

Request with curl
curl "http://[subdomain.itempath.com or IP]/api/material_codes/[id]" \ -X get \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]"
Example Response
{ "material_code": { "name": " MaterialCode1 " , "id": F38A05A7-D445-494F-B759-001F08329703 , "materialId": F687AB5F-E6F6-48A2-B748-10CE0A6E2C29 , "packSize": 12 , } }
Update Material Code /api/material_codes/[id]
put

Update a material code by ID and get a response.

Body Parameters

  • name string

    The material code. Must be unique to other codes and material names.

  • packSize integer

    Deprecated

Request with curl
curl "http://[subdomain.itempath.com or IP]/api/material_codes/[id]" \ -X put \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]"
-d '{
    "name": "UpdatedCode"
}'
Example Response
{
    "material_code": [
        {
            "id": "FBB20FCE-6CBC-48EB-8879-914865BA116A",
            "packSize": null,
            "name": "UpdatedCode",
            "materialId": "EBD286D1-4D5A-41C3-B24A-E62FC1008E57"
        }
    ]
}
Delete Material Code /api/material_codes/[id]
delete

Delete a material code from the PPG database.

Body Parameters

Request with curl
curl "http://[subdomain.itempath.com or IP]/api/material_codes/[id]" \ -X delete \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]"
Example Response
{ "deleted": "true" }