Xpenser API: Contacts

Xpenser uses the concept of Contacts to encapsulate:

Query / List

URL: http://xpenser.com/api/v1.0/orgchart/people/{{company_id}}

Method: GET

Response:

Sample Usage:

List all expenses in the default report in json format:

curl -u user:password "http://xpenser.com/api/v1.0/people/458"

Response:

[
    {
        "first_name": "Sample Company", 
        "last_name": "", 
        "level": 0, 
        "type": "C", 
        "id": 458, 
        "role": "", 
        "deptname": "", 
        "email": "admin@dev.com"
    }, 
    {
        "first_name": "Jim", 
        "last_name": "Adamin", 
        "user_id": 507, 
        "level": 1, 
        "type": "I", 
        "id": 457, 
        "parent_id": 458, 
        "role": "", 
        "deptname": "", 
        "email": "admin@dev.com"
    }, 
    {
        "first_name": "Mike", 
        "last_name": "Chief", 
        "user_id": 508, 
        "level": 1, 
        "type": "I", 
        "id": 459, 
        "parent_id": 458, 
        "role": "", 
        "deptname": "", 
        "email": "ceo@dev.com"
    }, 
    {
        "first_name": "Sarah", 
        "last_name": "Vice", 
        "user_id": 509, 
        "level": 2, 
        "type": "I", 
        "id": 460, 
        "parent_id": 459, 
        "role": "", 
        "deptname": "", 
        "email": "vp@dev.com"
    }, 
    {
        "first_name": "John", 
        "last_name": "Employee", 
        "user_id": 514, 
        "level": 3, 
        "type": "I", 
        "id": 465, 
        "parent_id": 460, 
        "role": "", 
        "deptname": "", 
        "email": "e4@dev.com"
    }, 
    {
        "first_name": "Jack", 
        "last_name": "Employee", 
        "user_id": 515, 
        "level": 4, 
        "type": "I", 
        "id": 466, 
        "parent_id": 465, 
        "role": "", 
        "deptname": "", 
        "email": "e5@dev.com"
    }
]

Create

URL: /api/v1.0/orgchart/contact/

Method: POST

Parameters:

Sample Usage:

curl -u user:password -d "first_name=John&last_name=Doe&email=john@something.com&parent_id=465" "http://xpenser.com/api/v1.0/orgchart/contact/"

Response:

{
    "first_name": "John", 
    "last_name": "Doe", 
    "user_id": 516, 
    "level": 5,
    "type": "I", 
    "id": 467, 
    "parent_id": 465, 
    "role": "", 
    "deptname": "", 
    "email": "john@something.com"
}

Read

URL: /api/v1.0/orgchart/contact/{contact_id}

Method: GET

Update

URL: /api/v1.0/orgchart/contact/{contact_id}

Method: POST

Delete

URL: `/api/v1.0/orgchart/contact/{contact_id}/?action=delete`

Method: POST

Response: HTTP 204 return code