# Examples of API requests

A generic swagger is available [here](https://trial.datome.io/swagger).&#x20;

1. To create a model, a POST request containing the model's required attributes is sent to the appropriate endpoint:

```jsx
curl --location --request POST 
'https://[your_organization].datome.io/api/models/fabric/' \
--header 'Authorization: Bearer 74a6c88d-62fe-4c13-8b40-c21fabbae819' \
--header 'Content-Type: application/json' \
--data '{
    "unique_name": "silklot00456",
    "id_technician": 965,
    "id_employee": 15264,
    "available": false
}'
```

2. After creating the model ***silklot00456***, the new Garment can be directly linked to it during the creation process:

```jsx
curl --location --request POST 
'https://[your_organization].datome.io/api/models/garment/' \
--header 'Authorization: Bearer 74a6c88d-62fe-4c13-8b40-c21fabbae819' \
--header 'Content-Type: application/json' \
--data '{
    "serial_number": "12345",
    "garment_type": "shirt",
    "size": "M",
    "fabric_relationship": "silklot00456",
    "available": false
}'
```

3. To call the mutation ***send\_to\_confirmed***, a POST request is sent to the correct endpoint containing all the parameters defined in the Model:

```jsx
curl --location --request POST 
'https://[your_organization].datome.io/api/models/fabric/silklot00456/mutations/send_to_confirmed' \
--header 'Authorization: Bearer 74a6c88d-62fe-4c13-8b40-c21fabbae819' \
--header 'Content-Type: application/json' \
--data '{
    "id_technician": 987,
    "id_amployee": 14005
}'
```

4. In this final API request example, the request body contains the required input parameter to call the second mutation ***send\_to\_recalled*** defined in the ***fabric*** Model, which in this case, updates the notes field of the ***silklot00456*** model.

```jsx
curl --location --request POST 
'https://[your_organization].datome.io/api/models/garment/12345/mutations/send_to_recalled' \
--header 'Authorization: Bearer 74a6c88d-62fe-4c13-8b40-c21fabbae819' \
--header 'Content-Type: application/json' \
--data '{
    "params": {},
    "external_mutations": {
        "fabric": {
            "send_to_recalled": {
                "silklot00456": {
                     "params": {
                         "notes": "invalid product"
                     }
                }
            }
        }
    }
}'
```

> **Note**: The values for the **send\_to\_recalled** mutation of the Model Garment should be listed in the first **params** field. In the case given above, it can be blank. The values needed for the **send\_to\_recalled** mutation of the Model Fabric are listed in the **params** section that comes after. In the case shown above, it gives a value for **notes**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.datome.io/examples-of-api-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
