/admin/addresses/:id/contacts
Path: /admin/addresses/:id/contacts
Namespace: admin
Parent Resource: addresses
Overview
Contacts represent contact persons associated with an address. Each contact contains name, email, phone, and role information.
Available Operations
List Contacts (GET)
Endpoint: GET /admin/addresses/:id/contacts.json
Description: Retrieve all contacts for a specific address.
Request Example:
GET /admin/addresses/123/contacts.jsonResponse (200 OK):
{
"contacts": [
{
"id": 1,
"address_id": 123,
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"role": "Manager"
}
]
}Show Contact (GET /:id)
Endpoint: GET /admin/addresses/:id/contacts/:id.json
Description: Retrieve a specific contact.
Request Example:
GET /admin/addresses/123/contacts/1.jsonResponse (200 OK):
{
"contact": {
"id": 1,
"address_id": 123,
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"role": "Manager"
}
}Create Contact (POST)
Endpoint: POST /admin/addresses/:id/contacts.json
Description: Create a new contact for an address.
Request Example:
POST /admin/addresses/123/contacts.json
Content-Type: application/json
{
"contact": {
"name": "Jane Smith",
"email": "[email protected]",
"phone": "+1234567891",
"role": "Accountant"
}
}Response (201 Created):
{
"contact": {
"id": 2,
"address_id": 123,
"name": "Jane Smith",
"email": "[email protected]"
}
}Update Contact (PATCH /:id)
Endpoint: PATCH /admin/addresses/:id/contacts/:id.json
Description: Update an existing contact.
Request Example:
PATCH /admin/addresses/123/contacts/1.json
Content-Type: application/json
{
"contact": {
"email": "[email protected]"
}
}Response (200 OK):
{
"contact": {
"id": 1,
"email": "[email protected]"
}
}Delete Contact (DELETE /:id)
Endpoint: DELETE /admin/addresses/:id/contacts/:id.json
Description: Delete a contact.
Request Example:
DELETE /admin/addresses/123/contacts/1.jsonResponse (204 No Content)
Batch Actions (POST /batch_action)
Endpoint: POST /admin/addresses/:id/contacts/batch_action.json
Description: Perform batch operations on selected contacts.
Request Example:
POST /admin/addresses/123/contacts/batch_action.json
Content-Type: application/json
{
"batch_action": "update",
"collection_selection": [1, 2, 3],
"batch_action_inputs": {
"role": "Manager"
}
}Response (200 OK):
{
"message": "Batch action completed",
"affected_count": 3
}Related Documentation
- Address Resource - Parent address resource