Skip to content
Kim Rostgaard Christensen edited this page Jan 23, 2015 · 2 revisions

A contact only makes sense in the context of an organization/reception. So, every call needs both a contact identification and a reception identification.

Listing all contacts in a reception

GET /contact/list/reception/<reception_id>')

Success

If the reception, identified by the supplied id exists, a list of contact objects in JSON format is returned. If no contacts are associated with the reception, an empty list is returned.

Example response.

HTTP status: 200 OK

[
    {
        "contact_id": 66,
        "reception_id": 4,
        "department": "Plumbing",
        "wants_messages": true,
        "enabled": true,
        "full_name": "Mario Mario",
        "distribution_list": {
            "to": [
                {
                    "contact": {
                        "id": 66,
                        "name": "Mario Mario"
                    },
                    "reception": {
                        "id": 4,
                        "name": "Hansen VVS A/S"
                    }
                }
            ],
            "cc": [],
            "bcc": []
        },
        "contact_type": "human",
        "phones": [],
        "endpoints": [],
        "backup": [
            "Luigi Mario"
        ],
        "emailaddresses": [
            "mario@hansenvvs.dk"
        ],
        "handling": [
            "Take a message"
        ],
        "workhours": [
            "Hverdage 07:00 – 18:00",
            "Weekend: 10:00 - 14:00"
        ],
        "tags": [
            "Super"
        ],
        "info": "Stuff",
        "position": "CPO (Cheif pluming officer)",
        "relations": "Brother of Luigi Mario",
        "responsibility": "Jumping around"
    },
    {
        "contact_id": 67,
        "reception_id": 4,
        "department": "Pipes",
        "wants_messages": true,
        "enabled": true,
        "full_name": "Luigi Mario",
        "distribution_list": {
            "to": [
                {
                    "contact": {
                        "id": 67,
                        "name": "Luigi Mario"
                    },
                    "reception": {
                        "id": 4,
                        "name": "Hansen VVS A/S"
                    }
                }
            ],
            "cc": [],
            "bcc": []
        },
        "contact_type": "human",
        "phones": [],
        "endpoints": [],
        "backup": [
            "Mario Mario"
        ],
        "emailaddresses": [
            "luigi@hansenvvs.dk"
        ],
        "handling": [
            "Call his brother Mario, or take a message"
        ],
        "workhours": [
            "Hverdage 07:00 – 18:00",
            "Weekend: 10:00 - 14:00"
        ],
        "tags": [
            "Super"
        ],
        "info": "Handles the dirty stuff",
        "position": "Assistant",
        "relations": "Brother of Mario Mario",
        "responsibility": "Taller stuff"
    }
]

Failure

If no active reception is associated with the supplied identification, an empty object is returned along with a "not found" status.

Example response

HTTP Status: 404 Not Found

{}

Retrieving the base data of a single contact.

GET /contact/<contact_id>/reception/<reception_id>

Success

If the contact of the supplied reception context is located, the contact object in JSON format.

Example response.

HTTP status: 200 OK

{
    "reception_id": 2,
    "contact_id": 1,
    "wants_messages": true,
    "enabled": true,
    "full_name": "Thomas Fisher",
    "contact_type": "human",
    "backup": [
        {
            "value": "Steen Fisher",
            "priority": 1
        }
    ],
    "emailaddresses": [
        {
            "value": "tf@ff.dk",
            "priority": 1
        }
    ],
    "handling": [
        {
            "value": "spørg ikke ind til ekstra stærk varianten",
            "priority": 1
        }
    ],
    "telephonenumbers": [
        {
            "value": "87654321",
            "priority": 1
        }
    ],
    "workhours": [],
    "tags": [
        "Fisker",
        "sømand",
        "pirat"
    ],
    "department": "Fangst",
    "info": "Tidligere fisker I militæret",
    "position": "Key fishing manager",
    "relations": "Gift med Triton Fisher",
    "responsibility": "Fersk fisk"
}

Failure

If no such combination of contact/reception identifications are present, an empty object is returned, along with a "not found" status.

Example response

HTTP Status: 404 Not Found

{}

Listing all calendar events for a contact in a reception

GET /contact/<contact_id>/reception/<reception_id>/calendar)

Success

Returns a list of calendar_entry objects in JSON format. An empty list is allowed, if no calendar are found.

Example response.

HTTP status: 200 OK

{TODO}

Listing all phonenumber for a contact in a reception

GET /contact/<contact_id>/reception/<reception_id>/phone)

Success

Returns a list of phonenumber objects in JSON format. An empty list is allowed, if no entries are found.

Listing a specific phonenumber for a contact in a reception

GET /contact/<contact_id>/reception/<reception_id>/phone/<phone_id>)

Returns a specific phonenumber object in JSON format, idenfied by the tuple {<contact_id>,<reception_id>,<phone_id>}

Clone this wiki locally