Endpoint: POST /api/contacts/{contactId}/addresses
Request Header:
- X-API-TOKEN: token
Request Body:
{
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
}
Response Body (Success):
{
"data": {
"id": 1,
"contact_id": 1,
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
}
}
Response Body (Failed):
{
"errors": "postal_code is required."
}
Endpoint: GET /api/contacts/{contactId}/addresses/{addressId}
Request Header:
- X-API-TOKEN: token
Response Body (Success):
{
"data": {
"id": 1,
"contact_id": 1,
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
}
}
Response Body (Failed):
{
"errors": "Address ID: {addressId} not found."
}
Endpoint: PUT /api/contacts/{contactId}/addresses/{addressId}
Request Header:
- X-API-TOKEN: token
Request Body:
{
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
}
Response Body (Success):
{
"data": {
"id": 1,
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
}
}
Response Body (Failed):
{
"errors": "postal_code is required."
}
Endpoint: DELETE /api/contacts/{contactId}/addresses/{addressId}
Request Header:
- X-API-TOKEN: token
Response Body (Success):
{
"data": "OK"
}
Response Body (Failed):
{
"errors": "Address ID: {addressId} not found."
}
Endpoint: GET /api/contacts/{contactId}/addresses/{addressId}
Request Header:
- X-API-TOKEN: token
Response Body (Success):
{
"data": [
{
"id": 1,
"street": "Street A. 12",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A12"
},
{
"id": 2,
"street": "Street A. 13",
"city": "Edinburgh",
"province": "Edinburgh",
"country": "Scotland",
"postal_code": "A13"
}
]
}
Response Body (Failed):
{
"errors": "Contact ID: {contactId} not found."
}