Sūtījumi
Piesaistīt pierakstus sūtījumam
Saistīt vienu vai vairākus pierakstus ar sūtījumu
POST
/
api
/
v1
/
shipments
/
{id}
/
appointments
curl --request POST \
--url https://anivahealth.com/api/v1/shipments/P2611194821/appointments \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"appointment_ids": [
"c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
]
}'
[
{
"id": "c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a",
"profile_id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"location_id": "b7e2d1f5-3c4a-4e8b-a2f1-9d0c1e2f3a4b",
"scheduled_at": "2026-04-15T08:30:00Z",
"status": "blood_drawn",
"created_at": "2026-04-01T09:45:00Z",
"updated_at": "2026-04-15T08:30:00Z",
"profile": {
"id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"first_name": "Maria",
"last_name": "Schmidt",
"email": "maria.schmidt@example.com",
"date_of_birth": "1985-03-22",
"sex": 2
},
"panels": [],
"individual_biomarkers": [],
"shipments": [
{
"id": "P2611194821",
"added_at": "2026-04-15T08:30:00Z"
}
]
}
]
{
"error": "Cannot attach appointments outside the allowed window — each appointment must be past blood-draw or the shipment must be less than 24 hours old. Blocked: c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
}
Pievieno šim sūtījumam vienu vai vairākus pierakstus. Idempotents pieprasījums — jau piesaistītie pieraksti tiek
klusām izlaisti.
Izmaiņu noteikums (katram pierakstam) ir: saiti var izveidot, ja VAI NU
- pierakstam jau veikta asins paņemšana (
blood_drawn), vai - sūtījums izveidots pirms mazāk nekā 24 stundām.
409 Conflict, lai vēsturiskie ieraksti paliktu nemainīgi.
Tas pats noteikums attiecas uz Atvienot pierakstus no
sūtījuma. Šie divi galapunkti ir vienīgais veids,
kā mainīt saites. Pierakstu API nav līdzvērtīga galapunkta.
Pieprasījums
Ceļa parametri
Pieprasījuma satura parametri
Atbilde
Ja pieprasījums izdodas, API atgriež200 OK ar piesaistītajiem pierakstiem tavā piekļuves kontekstā,
sākot ar vecāko saiti. Katram ierakstam ir tāda pati struktūra kā Iegūt pierakstu.
Kļūdu atbildes
| Statuss | Apraksts |
|---|---|
400 | Validācijas kļūda — piem., tukšs appointment_ids vai nederīgs UUID. |
403 | Piekļuve liegta — trūkst piekļuves tvēruma, sūtījums vai pieraksts ir ārpus piekļuves konteksta, vai piesaistīts mājas komplekta pasūtījums ir ārpus tava piekļuves konteksta. |
404 | Sūtījums nav atrasts, vai viens vai vairāki pieraksti nav atrasti. |
409 | Izmaiņu noteikums nav izpildīts — vismaz vienam pierakstam vēl nav veikta asins paņemšana un sūtījums ir vecāks par 24 stundām. Atbildē ir uzskaitīti ID. |
500 | Iekšēja servera kļūda. |
curl --request POST \
--url https://anivahealth.com/api/v1/shipments/P2611194821/appointments \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"appointment_ids": [
"c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
]
}'
[
{
"id": "c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a",
"profile_id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"location_id": "b7e2d1f5-3c4a-4e8b-a2f1-9d0c1e2f3a4b",
"scheduled_at": "2026-04-15T08:30:00Z",
"status": "blood_drawn",
"created_at": "2026-04-01T09:45:00Z",
"updated_at": "2026-04-15T08:30:00Z",
"profile": {
"id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"first_name": "Maria",
"last_name": "Schmidt",
"email": "maria.schmidt@example.com",
"date_of_birth": "1985-03-22",
"sex": 2
},
"panels": [],
"individual_biomarkers": [],
"shipments": [
{
"id": "P2611194821",
"added_at": "2026-04-15T08:30:00Z"
}
]
}
]
{
"error": "Cannot attach appointments outside the allowed window — each appointment must be past blood-draw or the shipment must be less than 24 hours old. Blocked: c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
}
⌘I
curl --request POST \
--url https://anivahealth.com/api/v1/shipments/P2611194821/appointments \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"appointment_ids": [
"c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
]
}'
[
{
"id": "c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a",
"profile_id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"location_id": "b7e2d1f5-3c4a-4e8b-a2f1-9d0c1e2f3a4b",
"scheduled_at": "2026-04-15T08:30:00Z",
"status": "blood_drawn",
"created_at": "2026-04-01T09:45:00Z",
"updated_at": "2026-04-15T08:30:00Z",
"profile": {
"id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
"first_name": "Maria",
"last_name": "Schmidt",
"email": "maria.schmidt@example.com",
"date_of_birth": "1985-03-22",
"sex": 2
},
"panels": [],
"individual_biomarkers": [],
"shipments": [
{
"id": "P2611194821",
"added_at": "2026-04-15T08:30:00Z"
}
]
}
]
{
"error": "Cannot attach appointments outside the allowed window — each appointment must be past blood-draw or the shipment must be less than 24 hours old. Blocked: c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a"
}