Capsule API

People & Organisations API

Data Reference

Person

When creating a person record contacts are optional, zero or more contacts are allowed in each category (address, email, phone).

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
    <
id>100</id> <!-- integer -->
    <
contacts>
        <
address>
            <
id>100</id> <!-- integer -->
            <
type>Office</type> <!-- optionsHome Office Postal -->
            <
street>1600 Amphitheatre Parkway</street> <!-- required -->
            <
city>Mountain View</city>
            <
state>CA</state>
            <
zip>94043</zip>
            <
country>United States</country
            <!-- 
ISO Country namesee /api/config/country for options -->
        </
address>
        <
email>
            <
id>101</id> <!-- integer -->
            <
type>Work</type> <!-- optionsHome Work -->
            <
emailAddress>e.smit@google.com</emailAddress
            <!-- 
requiredvalid email address -->
        </
email>
        <
phone>
            <
id>102</id>  <!-- integer -->
            <
type>Work</type> <!-- optionsHome Work Mobile Fax -->
            <
phoneNumber>+1 888 555555</phoneNumber> <!-- required -->
        </
phone>
    </
contacts>
    <
title>Mr</title> <!-- optionsMr Master Mrs Miss Ms Dr  -->
    <
firstName>Eric</firstName>
    <
lastName>Schmidt</lastName> <!-- required -->
    <
jobTitle>Chairman</jobTitle>
    <
organisationId>50</organisationId> <!-- integer -->
    <
organisationName>Google Inc</organisationName>
    <
about>Comment hehe</about>
</
person

Organisation

When creating a person record contacts are optional, zero or more contacts are allowed in each category (address, email, phone).

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<organisation>
    <
id>50</id> <!-- integer -->
    <
contacts>
        <
address>
            <
id>55</id> <!-- integer -->
            <
type>Office</type> <!-- optionsHome Office Postal -->
            <
street>1600 Amphitheatre Parkway</street> <!-- required -->
            <
city>Mountain View</city>
            <
state>CA</state>
            <
zip>94043</zip>
            <
country>United States</country> <!-- ISO Country namesee /api/config/country for options -->
        </
address>
        <
email>
            <
id>60</id> <!-- integer -->
            <
type>Work</type> <!-- optionsHome Work -->
            <
emailAddress>info@google.com</emailAddress> <!-- requiredvalid email address -->
        </
email>
        <
phone>
            <
id>61</id> <!-- integer -->
            <
type>Work</type> <!-- optionsHome Work Mobile Fax -->
            <
phoneNumber>+1 888 555555</phoneNumber> <!-- required -->
        </
phone>
    </
contacts>
    <
name>Google Inc</name> <!-- required -->
    <
about>Comment here</about>
</
organisation

Get Party

GET /api/party/{id}

Get details of a single person or organisation by party id.

List All Parties

GET /api/party[?start={start}][&limit={limit}]

Return all people & organisations visible to the authenticated user. Optionally the results can be limited or paged using the parameters &amo;limit and &start.

Example response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<parties size="2">
    <
organisation>
        

    
</organisation>
    <
person>
        

    
</person>    
</
parties

Search

GET /api/party?q={search term}[&start={start}][&limit={limit}]

Return all people & organisations which match the search term. The search term will be matched against name, telephone number and exact match on searchable custom fields. Optionally the results can be limited or paged using the parameters &amo;limit and &start.

Example response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<parties size="2">
    <
organisation>
        <
name>Albert Smith Limited</name>
        

    
</organisation>
    <
person>
        <
firstName>Jane</firstName>
        <
lastName>Smith</lastName>
        

    
</person>    
</
parties

List Modified Since

GET /api/party?lastmodified={YYYYMMDDTHHMMSS}[&start={start}][&limit={limit}]

Return person & organisation records that have been updated or created since the modified since date supplied. The modified since date should be in the format YYYYMMDDTHHMMSS, eg. Midnight June 31, 2009 GMT would be 20090631T000000. Optionally the results can be limited or paged using the parameters &amo;limit and &start.

List by Email Address

GET /api/party?email={email address}[&start={start}][&limit={limit}]

Return all people & organisations with matching email address. Optionally the results can be limited or paged using the parameters &amo;limit and &start.

List by Tag

GET /api/party?tag={tag}[&start={start}][&limit={limit}]

Return all people & organisations with tagged with matching tag. Note that the tag will need to be URL encoded. Optionally the results can be limited or paged using the parameters &amo;limit and &start.

List People at an Organisation

GET /api/party/{id}/people

Returns all the people at the selected organisation.

List Countries for Addresses

GET /api/resource/country

List of country names that can be supplied in the <country /> element of addresses. Alternatively ISO 3166-1 alpha-2 or alpha-3 codes can be used.

Example Response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<countries>
    <
country>Afghanistan</country>
    <
country>Åland Islands</country>
    <
country>Albania</country>
    <
country>Algeria</country>
    <
country>American Samoa</country>
    <
country>Andorra</country>
    ...
</
countries

Add Person

POST /api/person

Create a new person and optionally attach to an organisation. You can specify an organisation id or organisation name. If an organisation name is used an it is not already present on the account a new organisation will be created.

When adding addresses make the <country /> element if used should be populated with a country returned from the resource GET /api/resource/country or a ISO 3166-1 alternative.

If adding this person will exceed the accounts contact limit a 507 Insufficient Storage response will be returned.

Example request:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
    <
contacts>
        <
address>
            <
type>Office</type>
            <
street>1600 Amphitheatre Parkway</street>
            <
city>Mountain View</city>
            <
state>CA</state>
            <
zip>94043</zip>
            <
country>United States</country>
        </
address>
        <
email>
            <
type>Work</type>
            <
emailAddress>e.smit@google.com</emailAddress>
        </
email>
        <
phone>
            <
type>Work</type>
            <
phoneNumber>+1 888 555555</phoneNumber>
        </
phone>
    </
contacts>
    <
title>Mr</title>
    <
firstName>Eric</firstName>
    <
lastName>Schmidt</lastName>
    <
jobTitle>Chairman</jobTitle>
    <
organisationName>Google Inc</organisationName>
</
person

Example response:

HTTP/1.1 201 Created
Location: https://sample.capsulecrm.com/api/party/2

Add Organisation

POST /api/organisation

If adding this organisation will exceed the accounts contact limit a 507 Insufficient Storage response will be returned.

Example request:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    
<organisation>
        <
contacts>
            <
address>
                <
type>Office</type>
                <
street>1600 Amphitheatre Parkway</street>
                <
city>Mountain View</city>
                <
state>CA</state>
                <
zip>94043</zip>
                <
country>United States</country>
            </
address>
            <
email>
                <
type>Work</type>
                <
emailAddress>info@google.com</emailAddress>
            </
email>
            <
phone>
                <
type>Work</type>
                <
phoneNumber>+1 888 555555</phoneNumber>
            </
phone>
        </
contacts>
        <
name>Google Inc</name>
    </
organisation

Update Person

PUT /api/person/{id}

Update an existing person record, only attributes that are to be changed need to be supplied in the XML document. Where a value is not supplied it will remain with its current value. To null a field include a empty XML element for the field in the document.

Contact records (email, phone or address) can be updated where an id is provided, where an id for a contact is not provided it is assumed to be null and will be added to the person.

Example request:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
    <
jobTitle>Chairman &ampCEO</jobTitle>
    <
contacts>
        <
phone><phoneNumber>0800 555 555</phoneNumber></phone>
    </
contacts>
</
person

Update Organisation

PUT /api/organisation/{id}

Update an existing organisation record, only attributes that are to be changed need to be supplied in the XML document. Where a value is not supplied it will remain with its current value. To null a field include a empty XML element for the field in the document.

Contact records (email, phone or address) can be updated where an id is provided, where an id for a contact is not provided it is assumed to be null and will be added to the person.

Example request:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<organisation>
    <
name>Google Inc.</name>
    <
contacts>
        <
phone><phoneNumber>0800 555 555</phoneNumber></phone>
    </
contacts>
</
organisation

Delete Party

DELETE /api/party/{id}

Deletes the selected person or organisation from Capsule. Operation cannot be performed on the Person record for a user.

Capsule is a service of Zestia Ltd which is a company registered in England with company number 06418281. © 2008-2012 Zestia Ltd. All Rights Reserved.