The Manufacturing API lets you sync products and production schedules from your ERP or MES into Mitti. You name every record by your own codes, so you never have to look up a Mitti ID first.
| Record | Your key |
|---|---|
| Production line | production_line_external_id |
| Product | sku_code |
| Scheduled run | the production line's site + work_order_number |
Codes are matched without regard to case. A record keeps the case it was first stored with.
Before you start
- Set an external ID on each production line in Mitti. A line without one cannot be named by this API.
- The API token needs the "Manufacturing: Admin" permission.
- The token's user needs access to the site of each production line you write to.
How a batch behaves
Every endpoint takes up to 500 items.
- Each item succeeds or fails on its own. Each result has an
outcome. A failed item also has anerrorwith a stablecode, thefieldthat caused it, and amessage. The other items are still written. Treat an unknowncodeoroutcomeas a failure, because new values may be added. - Only a malformed request fails as a whole. It returns
400 Bad Request, the message names the invalid field, and nothing is written. One invalid value in any item rejects the whole batch, so check your data before you send it. - Every batch is safe to retry. Sending the same batch again gives the same state. It does not create duplicates, even after a partial failure.
- Results are in request order. Each result repeats your key as you sent it.
Scheduled runs and work orders
A work order identifies one scheduled run at a site. Sending a work order that is scheduled and not started updates that run, even if it moves to another production line at the same site. Otherwise a new scheduled run is created.
A run that has started is never changed or deleted. If you send a work order whose run has started, a new scheduled run is created.
Partial updates
When you update a scheduled run, a field that you leave out keeps its current value. To write only some fields, or to clear an optional field, list the fields in fields_to_write. Only the listed fields are written, and a listed field that you leave out is cleared.
The product is looked up only when it is needed: when the run is new, or when you write the product.