MutacjaBetaMutation.createProduct
Adds a product to an existing order that is not archived. It starts as NO_FILES, before any print file. Elements and operations are entered with the order (createOrder) or by the print shop.
| Wymagany zakres | orders:write |
|---|---|
| Dostępne od | Prynt 0.28.0 |
| Stabilność | Beta (co to znaczy) |
| Ponawianie | Wysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja |
Argumenty
| Nazwa | Typ | Opis |
|---|---|---|
inputwymagane | CreateProductInput! | The new product. |
Zwraca
Przykład
mutation AddProduct($input: CreateProductInput!) { createProduct(input: $input) { id orderId number name status }}{ "input": { "orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12", "number": 3, "name": "Wizytówki", "quantity": 500, "unit": "PIECES", "price": 120, "priceMarkup": 0, "taxRate": 23, "weight": 1.2 }}IDEMPOTENCY_KEY=$(uuidgen) # ponawiaj z tym samym kluczem
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \ -H "Authorization: Bearer $PRYNT_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEMPOTENCY_KEY" \ --data-binary @- <<'JSON'{ "query": "mutation AddProduct($input: CreateProductInput!) {\n createProduct(input: $input) {\n id\n orderId\n number\n name\n status\n }\n}", "variables": { "input": { "orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12", "number": 3, "name": "Wizytówki", "quantity": 500, "unit": "PIECES", "price": 120, "priceMarkup": 0, "taxRate": 23, "weight": 1.2 } }}JSON{ "data": { "createProduct": { "id": "be5a7192-4d6f-4a81-9cad-2e3f4a5b6c74", "orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12", "number": 3, "name": "Wizytówki", "status": "NO_FILES" } }}