Customer Relations API Documentation

Overview

This sub-collection contains a customer account's relations to other customers. These are used in group memberships, and additionally allow parents to manage their children's accounts.

All customer relations are symmetric. This means that when a relation is created from customer A to customer B, a reverse relation is automatically created from customer B back to customer A. For example, if Bob is Alice's child, then Alice will be Bob's parent.

Fields

Name Type Restrictions Required? Description
id integer Automatic Automatic The unique identifier of the relation. This is placed in the URL when making API calls for the relation.
url string Automatic Automatic The unique API URL of the relation.
related_customer_id integer Must be the ID of a customer. May not be duplicated, and may not be the same as the base customer's ID. Yes The customer to whom the base customer is related.
related_customer_url string Automatic Automatic The related customer's unique API URL.
related_customer_email string Automatic Automatic The related customer's email address.
related_customer_first_name string Automatic Automatic The related customer's first name.
related_customer_last_name string Automatic Automatic The related customer's last name.
relation string Must be one of the supported relation options. Yes The relationship of the related customer to the base customer. This term describes the related customer, so, for example, if CHI (child) is chosen, that means the related customer is a child of the base customer.
created_at string (ISO-8601 datetime) Automatic Automatic When the relation was added to the Capitan database.
updated_at string (ISO-8601 datetime) Automatic Automatic When the relation's record in the Capitan database was last updated.

Relation Options

Name Syntax
Spouse SPO
Partner PRT
Parent PRE
Child CHI
Guardian GUA
Ward WAR
Sibling SIB
Other OTH

Operations

List

Request
GET /api/customers/35/relations/

Response
200 OK
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 421,
            "url": "https://api.hellocapitan.com/api/customers/35/relations/421/",
            "related_customer_id": 923,
            ...
        },
        ...
    ]
}

Read

Request
GET /api/customers/35/relations/421/

Response
200 OK
{
    "id": 35,
    "url": "https://api.hellocapitan.com/api/customers/35/relations/421/",
    "related_customer_id": 923,
    ...
}

Create

Request
POST /api/customers/35/relations/
{
    "related_customer_id": 591,
    "relation": "CHI"
}

Response
201 Created
{
    "id": 713,
    "url": "https://api.hellocapitan.com/api/customers/35/relations/713/",
    "related_customer_id": 591,
    ...
}

Remove

Request
DELETE /api/customers/35/relations/713/

Response
204 NO CONTENT