Material Codes

Attributes

  • name string

    The alternate lookup code.

  • id uuid

  • materialId uuid

    The ID of the material.

  • packSize integer

    Deprecated.

Endpoints

List Material Codes

get /api/material_codes

Get the material codes from the PPG database and return a JSON response.

Arguments

  • name string

    Only return material codes that have the given name.

  • materialId uuid

    Return codes for the material with this ID.

  • packSize integer

    Deprecated.

  • limit integer

    A limit on the number of objects to be returned. Limit can range between 1 and 1000.

    Default value: 250

  • page integer

    Page-numbering is based on the value of the "limit" argument. If limit=20, then page=0 will display the hits from 1 to 20. (Page numbers are zero-based.) Using page without a limit returns all items.

  • orderBy string, array

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

  • countOnly boolean

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

    Default value: false

Request with curl
curl "http://[Your IP] /api/material_codes" \ -X get \ -H "Content-Type: application/json" \ -H "Authorization: Bearer [Your JWT Access Token]"
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

post /api/material_codes

Add a new material code to a material in the PPG database and return a response.

Body Parameters

  • name string
    REQUIRED

    The material code

  • materialId uuid
    REQUIRED

    The ID of the material this code belongs to.

  • packSize integer

    Deprecated.

Request with curl
curl "http://[Your 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

get /api/material_codes/[id]

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://[Your 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

put /api/material_codes/[id]

Update a material code by ID and get a response.

Arguments

  • name string

    The material code

  • packSize integer

    Deprecated

Request with curl
curl "http://[Your 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

delete /api/material_codes/[id]

Delete a material code from the PPG database.

Arguments

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