Comment on page
Examples of API requests
A generic swagger is available here. A specific one with your endpoints is available at your organization’s URL (https://[your_organization].datome.io/swagger).
- 1.To create a model, a POST request containing the model's required attributes is sent to the appropriate endpoint:
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:
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:
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.
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.
Last modified 5mo ago