Skip to main content

Examples

The following examples show potential usage of the Part Adjustment Endpoints.

To use these examples, replace API_KEY with a key generated from https://app.machinemetrics.com/settings/api-keys

These requests were run in a staging environment, so the individual part adjustments and their corresponding ids included in the examples will not be present in your own environment.

POST /part-adjustment (create)

Request

curl --location --request POST 'https://api.machinemetrics.com/part-adjustment (https://api-staging.machinemetrics.com/part-adjustment)' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"machine_id":"00000000-0000-0000-0000-000000000000",
"scrapcount":5,
"count":-5,
"reject_behavior":"nonconform",
"message":"These parts don't conform",
"category_id":9
}'

Response

{
"category_id":9,
"id":"00000000-0000-0000-0000-000000000000",
"message":"These parts don't conform",
"adjustmenttime":"2020-04-29T15:26:01.999Z",
"scrapcount":5,
"count":-5,
"dataitemname":null,
"reject_behavior":"nonconform",
"scrap":false
}

PUT /part-adjustment/:id (update)

Request

curl --location --request PUT 'https://api.machinemetrics.com/part-adjustment/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"scrapcount": -15,
"count": 10,
"message": "Lets update some stuff",
"adjustmenttime": "2020-04-27T14:45:55.999Z",
"category_id": 9
}'

####Response

{
"category_id":9,
"id":"1b696fe4-7ae4-4765-8926-11d1360b7ef0",
"message":"Lets update some stuff",
"adjustmenttime":"2020-04-27T14:45:55.999Z",
"scrapcount":-15,
"count":10,
"dataitemname":null,
"reject_behavior":"scrap",
"scrap":true
}

DELETE /part-adjustment/:id (delete)

Request

curl --location --request DELETE 'https://api.machinemetrics.com/part-adjustment/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: Bearer API_KEY'

Response

null

GET /part-adjustments (read)

Request

curl --location --request GET 'https://api.machinemetrics.com/part-adjustments?machine_id=1d28bdbb-ddc1-4531-80ed-415120485547&start=2020-03-01&end=2021-05-01' \
--header 'Authorization: Bearer API_KEY'

Response

[
{
"category_id":9,
"id":"00000000-0000-0000-0000-000000000000",
"message":"These parts don't conform",
"adjustmenttime":"2020-04-29T15:25:56.999Z",
"scrapcount":5,
"count":-5,
"dataitemname":null,
"reject_behavior":
"nonconform",
"scrap":false
},
...
]

GET /part-adjustment-types (read)

Request

curl --location --request GET 'https://api.machinemetrics.com/part-adjustment-types' \
--header 'Authorization: Bearer API_KEY'

Response

[
{
"id":9,
"company_id":null,
"name":"Manual Part",
"color":"#000000",
"correction":false,
"scrap":false,
"reject_behavior":"operator",
"hidden":false,
"createdAt":null,
"updatedAt":null
}
]