Materials

Create a material

POST/materials

Creates a material and returns it with its id. The code must be unique in the shop: a code that another material has answers 409 already-exists. The body names each entity it refers to as {"id": …} or {"code": …}. A reference that names no entity of the shop answers 400 invalid-request pointing at it.

Request Headers

Bearer <token>

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

A material to create. A material created without color has none, one created without appearance shows in plain gray, one created without processing_capabilities has no capability, and one created without status is inactive.

Response Headers

201, 400, 401, 403, 404, 413, 429, default

201, 400, 401, 403, 404, 413, 429, default

201, 400, 403, 404, 429, default

201, 400, 403, 404, 429, default

429

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/materials" \  -H "Authorization: Bearer ff_shop_…" \  -H "Content-Type: application/json" \  -d '{    "kind": {      "id": "string"    },    "code": "string",    "thickness_mm": 0,    "price_ncu_m2": 0,    "tile_size_mm": 0,    "drawing_padding_mm": 0  }'
{  "result": {    "code": "string",    "color": "string",    "thickness_mm": 0,    "price_ncu_m2": 0,    "tile_size_mm": 0,    "drawing_padding_mm": 0,    "id": "string",    "kind": {      "id": "string"    },    "status": "active",    "appearance": {      "id": "string"    },    "processing_capabilities": {      "cutting": {        "id": "string"      },      "engraving_light": {        "id": "string"      },      "engraving_medium": {        "id": "string"      },      "engraving_heavy": {        "id": "string"      }    }  }}