Service Dog Standards Help

Emergency contacts management

Emergency contacts management - single contact mode

1 Get first created (primary) emergency contact

Endpoint: GET /profile/emergency-contacts/primary
Description: Get first created user emergency contact.

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{}

Response (200 Ok):

{ "message": "Primary emergency contact retrieved successfully", "user_id": 13, "data": { "id": 4, "deleted_at": null, "created_at": "2025-03-07T22:47:34.000000Z", "updated_at": "2025-03-07T22:47:34.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": null, "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": null, "secondary_disability": null } }

Response (404 Not found):

{ "message": "Primary emergency contact not found", "user_id": 13, "data": null }

2 Update first created (primary) emergency contact

Endpoint: PUT /profile/emergency-contacts/primary
Description: Create/Update first created user emergency contact (if it not exists, it will be created). Primary disability and secondary disability can be null.

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{ "first_name":"John", "last_name":"Doe", "primary_phone":"0989894433", "email":"[email protected]", "rel_to_disabled_individual": null, "primary_disability": "arthritis", "secondary_disability": "ataxia" }

Response (200 Ok):

{ "message": "Primary emergency contact updated successfully", "user_id": 13, "data": { "id": 10, "deleted_at": null, "created_at": "2025-03-12T10:50:24.000000Z", "updated_at": "2025-03-12T10:52:39.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": null, "primary_phone": "098-989-4433", "email": "[email protected]", "primary_disability": "arthritis", "secondary_disability": "ataxia" }, "contact_list": [ { "id": 10, "deleted_at": null, "created_at": "2025-03-12T10:50:24.000000Z", "updated_at": "2025-03-12T10:52:39.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": null, "primary_phone": "098-989-4433", "email": "[email protected]", "primary_disability": "arthritis", "secondary_disability": "ataxia" } ] }

3 Delete first created (primary) emergency contact

Endpoint: DELETE /profile/emergency-contacts/primary
Description: Delete first created user emergency contact.

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{}

Response (200 Ok):

{ "message": "Primary emergency contact deleted successfully", "user_id": 13, "contact_list": [] }

Emergency contacts management - multi contact mode

1 Get all emergency contacts

Endpoint: GET /profile/emergency-contacts
Description: Get all user emergency contacts.

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{}

Response (200 Ok):

{ "message": "Emergency contacts retrieved successfully", "user_id": 13, "data": [ { "id": 4, "deleted_at": null, "created_at": "2025-03-07T22:47:34.000000Z", "updated_at": "2025-03-07T22:47:34.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": null, "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": null, "secondary_disability": null } ] }

2 Add user emergency contact

Endpoint: POST /profile/emergency-contacts
Description: Add new user emergency contact.

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{ "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null }

Response (200 Ok):

{ "message": "Emergency contact added successfully", "user_id": 13, "data": { "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null, "account_id": 13, "updated_at": "2025-03-07T22:51:30.000000Z", "created_at": "2025-03-07T22:51:30.000000Z", "id": 5 }, "contact_list": [ { "id": 5, "deleted_at": null, "created_at": "2025-03-07T22:51:30.000000Z", "updated_at": "2025-03-07T22:51:30.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null }, { "id": 4, "deleted_at": null, "created_at": "2025-03-07T22:47:34.000000Z", "updated_at": "2025-03-07T22:47:34.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": null, "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": null, "secondary_disability": null } ] }

3 Update user emergency contact

Endpoint: PUT /profile/emergency-contacts/{contact_id}}
Description: Update the emergency contact by its id

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{ "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null }

Response (200 Ok):

{ "message": "Emergency contact updated successfully", "data": { "id": 3, "deleted_at": null, "created_at": "2025-03-07T22:39:20.000000Z", "updated_at": "2025-03-07T22:45:22.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null }, "user_id": 13, "contact_list": [ { "id": 3, "deleted_at": null, "created_at": "2025-03-07T22:39:20.000000Z", "updated_at": "2025-03-07T22:45:22.000000Z", "published": 0, "account_id": 13, "first_name": "John", "last_name": "Doe", "rel_to_disabled_individual": "trainer", "primary_phone": "0989894433", "email": "[email protected]", "primary_disability": "autism", "secondary_disability": null } ] }

4 Delete user emergency contact

Endpoint: DELETE /profile/emergency-contacts/{contact_id}}
Description: Delete the emergency contact by its id

Request Headers:

"Authorization": "Bearer token here" X-API-Key: your_api_key Content-Type: application/json

Request Body (JSON):

{}

Response (200 Ok):

{ "message": "Emergency contact deleted successfully", "user_id": 13, "contact_list": [] }
13 March 2025