Skip to content
Jacob Sparre Andersen edited this page Mar 24, 2014 · 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

{
    "contacts": [
        { 
            "reception_id": 1,
            "contact_id": 7,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Ulrik Jønsson",
            "contact_type": "human",
            "backup": [
                {
                    "value": "Karl Rostgaard Christensen",
                    "priority": 1
                }
            ],
            "emailaddresses": [],
            "handling": [],
            "telephonenumbers": [
                {
                    "value": "12345678",
                    "priority": 1
                }
            ],
            "workhours": [],
            "tags": [
                "Granvej",
                "Mosekrogen"
            ],
            "department": "",
            "info": "",
            "position": "",
            "relations": "",
            "responsibility": ""
        },
        {
            "reception_id": 1,
            "contact_id": 17,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Helga Helgason",
            "contact_type": "human"
        },
        {
            "reception_id": 1,
            "contact_id": 18,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Martinus Martinussen",
            "contact_type": "human"
        },
        {
            "reception_id": 1,
            "contact_id": 19,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Bob Børgesen",
            "contact_type": "human"
        },
        {
            "reception_id": 1,
            "contact_id": 20,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Charlie Carstensen",
            "contact_type": "human"
        },
        {
            "reception_id": 1,
            "contact_id": 21,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Alice Arnesen",
            "contact_type": "human"
        },
        {
            "reception_id": 1,
            "contact_id": 46,
            "wants_messages": true,
            "enabled": true,
            "full_name": "Carlo Connemara",
            "contact_type": "human"
        }
    ]
}

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