api.customers

/api/customers/

GET /api/customers/

Description:

Return the list of existing customers
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<customers>
    <customer uri="/customers/X/" id="X">
        <name>
            <first>[str]</first>
            <last>[str]</last>
        </name>
        <company>[str]</company>
        <email>[str]</email>
        <homepage>[str]</homepage>
        <phone_numbers>
            <phone_number id="[int]">
                <main>[bool]</main>
                <type>[enum: work|home|mobile|main|home fax|work fax|toll-free|other]</type>
                <list_order>[int]</list_order>
                <number>[str]</number>
            </phone_number>
            [...] <!-- 4 phone numbers with ids 1-4 -->
        </phone_numbers>
        <photo uri="/customers/X/customer_photo/"/>
        <is_company>[bool]</is_company>
    </customer>
    [...]
</customers>

POST /api/customers/

Description:

Create a new customer
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<customer>
    <name>
        <first>[str]</first> <!-- Optional -->
        <last>[str]</last> <!-- Optional -->
    </name>
    <company>[str]</company> <!-- Optional -->
    <email>[str]</email> <!-- Optional -->
    <homepage>[str]</homepage> <!-- Optional -->
    <phone_numbers> <!-- Optional -->
        <phone_number id="[int]"> <!-- id and/or list_order must be present. -->
            <main>[bool]</main> <!-- Optional -->
            <type>[enum: work|home|mobile|main|home fax|work fax|toll-free|other]</type> <!-- Optional -->
            <number>[str]</number> <!-- Optional -->
            <list_order>[int]</list_order> <!-- id and/or list_order must be present -->
        </phone_number>
        [...] <!-- 0-4 values possible -->
    </phone_numbers>
    <billing> <!-- Optional -->
        <address>
            <address1>[str]</address1> <!-- Optional -->
            <address2>[str]</address2> <!-- Optional -->
            <city>[str]</city> <!-- Optional -->
            <state>[str]</state> <!-- Optional -->
            <country>[str]</country> <!-- Optional -->
            <zip>[str]</zip> <!-- Optional -->
        </address>
    </billing>
    <shipping> <!-- Optional -->
        <address>
            <address1>[str]</address1> <!-- Optional -->
            <address2>[str]</address2> <!-- Optional -->
            <city>[str]</city> <!-- Optional -->
            <state>[str]</state> <!-- Optional -->
            <country>[str]</country> <!-- Optional -->
            <zip>[str]</zip> <!-- Optional -->
        </address>
    </shipping>
    <is_company>[bool]</is_company> <!-- Optional -->
    <birthday>[date]</birthday> <!-- Optional -->
    <credit_hold>[bool]</credit_hold> <!-- Optional -->
    <credit_limit>[decimal]</credit_limit> <!-- Optional -->
    <tax_status id="[int]"/> <!-- Optional -->
    <tax_code id="[int]"/> <!-- Optional -->
    <account_status id="[int]"/> <!-- Optional -->
    <user id="[int]"/> <!-- Optional -->
    <terms id="[int]"/> <!-- Optional -->
    <currency id="[int]"/> <!-- Optional -->
    <merged_to> <!-- Optional -->
        <customer id="[int]"/> <!-- Optional. Unmerge if not present. -->
    </merged_to>
</customer>

Response:

<customer uri="/customers/X/" id="X">
    <!-- See GET /customers/X/ for details -->
</customer>
Expected Errors:

/api/customers/(d+)/

GET /api/customers/(d+)/

Description:

Return detailed information of a specific customer
can_lock requires_lock has_etag requires_etag
True False False False

Request:

<!-- No XML Request. -->

Response:

<customer uri="/customers/A/" id="A">
    <created>[datetime]</created>
    <modified>[datetime]</modified>
    <name>
        <first>[str]</first>
        <last>[str]</last>
    </name>
    <company>[str]</company>
    <email>[str]</email>
    <homepage>[str]</homepage>
    <phone_numbers>
        <phone_number id="[int]">
            <main>[bool]</main>
            <type>[enum: work|home|mobile|main|home fax|work fax|toll-free|other]</type>
            <list_order>[int]</list_order>
            <number>[str]</number>
        </phone_number>
        [...] <!-- 4 phone numbers with ids 1-4 -->
    </phone_numbers>
    <photo uri="/customers/X/customer_photo/"/>
    <is_company>[bool]</is_company>
    <billing>
        <address>
            <address1>[str]</address1>
            <address2>[str]</address2>
            <city>[str]</city>
            <state>[str]</state>
            <country>[str]</country>
            <zip>[str]</zip>
        </address>
    </billing>
    <shipping>
        <address>
            <address1>[str]</address1>
            <address2>[str]</address2>
            <city>[str]</city>
            <state>[str]</state>
            <country>[str]</country>
            <zip>[str]</zip>
        </address>
    </shipping>
    <credit_hold>[bool]</credit_hold>
    <new_import>[bool]</new_import>
    <new_update>[bool]</new_update>
    <birthday>[date]</birthday>
    <credit_limit>[decimal]</credit_limit>
    <customer_id>[str]</customer_id>
    <credit_status uri="/customers/A/credit_status/"/>
    <ar_balance uri="/customers/A/ar_balance/"/>
    <import_id>[str]</import_id>
    <account_status uri="/setup/account_statuses/B/" id="B">
        <!-- See GET /setup/account_statuses/X/ for details -->
    </account_status>
    <user uri="/users/C/" id="C"/>
    <customer_category uri="/setup/customer_categories/J/" id="J">
        <!-- See GET /setup/customer_categories/X/ response for details. -->
    </customer_category>
    <customer_referredby uri="/setup/customer_referredbys/D/" id="D">
        <!-- See GET /setup/customer_referredbys/X/ for details -->
    </customer_referredby>
    <currency uri="/setup/currencies/E/" id="E"/>
    <tax_code uri="/tax_codes/F/" id="F"/>
    <tax_exemption uri="/setup/tax_exemptions/G/" id="G"/>
    <terms uri="/setup/terms/H/" id="H"/>
    <language>
        <id>[int]</id>
        <language_name>[str]</language_name>
    </language>
    <merged_to>
        <customer uri="/customers/J/" id="J"/> <!-- Empty if not merged -->
    </merged_to>
</customer>
Expected Errors:

PUT /api/customers/(d+)/

Description:

Update the details of a specific customer
can_lock requires_lock has_etag requires_etag
True True False False

Request:

<customer>
    <!-- See POST /api/customers/ for details -->
</customer>

Response:

<customer uri="/customers/X/" id="X">
    <!-- See GET /api/customers/X/ for details -->
</customer>
Expected Errors:

/api/customers/(d+)/ar_balance/

GET /api/customers/(d+)/ar_balance/

Description:

Return the list of account receivable balances for a specific customer.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<ar_balance uri="/customers/X/ar_balance/">
    <total>[decimal]</total>

    <!-- 0 or more invoices -->
    <invoice uri="/invoices/Y/" id="Y">
        <credit_amount>[decimal]</credit_amount>
        <datetime_created>[datetime]</datetime_created>
        <invoice_id>[str]</invoice_id>
    </invoice>
</ar_balance>

/api/customers/(d+)/contacts/

Called when either we POST, or wish for a list of contacts.

GET /api/customers/(d+)/contacts/

Description:

Return the list of a customer's contacts
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<contacts>
    <contact uri="/customers/X/contacts/Y/ id="Y">
        <!-- See GET /customers/X/contacts/Y/ for details. -->
    </contact>
    [...]
</contacts>

/api/customers/(d+)/contacts/(d+)/

Called when GET or PUT methods are made to a contact.

GET /api/customers/(d+)/contacts/(d+)/

Description:

Return a specific customer's contact
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<contact uri="/customers/X/contacts/Y/" id="Y">
    <name>
        <first>[str]</first>
        <last>[str]</last>
    </name>
    <department>[str]
    <position>[str]
    <email>[str]
    <notes>[str]</note>
    <phone_numbers>
        <phone_number>
            <type>[enum: work|home|mobile|main|home fax|work fax|toll-free|other]</type>
            <list_order>[int]</list_order>
            <number>[str]</number>
        </phone_number>
        <phone_number>
            <type>[enum: work|home|mobile|main|home fax|work fax|toll-free|other]</type>
            <list_order>[int]</list_order>
            <number>[str]</number>
        </phone_number>
        <!-- A contact can have 0 - 2 phone numbers, and no more -->
    </phone_numbers>
    <address>
        <address1>[str]</address1>
        <address2>[str]</address2>
        <city>[str]</city>
        <state>[str]</state>
        <country>[str]</country>
        <zip>[str]</zip>
    </address>
</contact>

/api/customers/(d+)/credit_status/

GET /api/customers/(d+)/credit_status/

Description:

Return the current credit outstanding for the customer.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<credit_status uri="/customers/X/credit_status/">
    <total>[decimal]</total>
</credit_status>

/api/customers/(d+)/customer_photo/

GET /api/customers/(d+)/customer_photo/

Description:

Return the photo of a specific customer
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

[Binary Image Data]

POST /api/customers/(d+)/customer_photo/

Description:

Add a photo for a specific customer
can_lock requires_lock has_etag requires_etag
False True False False

Request:

[Binary Image Data]

Response:

<response>
    <customer uri="/customers/X/" id="X">
        <!-- See GET /customers/X/ response for details -->
    </customer>
</response>

PUT /api/customers/(d+)/customer_photo/

Description:

Update the photo of a specific customer
can_lock requires_lock has_etag requires_etag
False True False False

Request:

[Binary Image Data]

Response:

<!-- No XML Response -->

/api/customers/(d+)/notes/

GET /api/customers/(d+)/notes/

Description:

Return a list of notes for the customer
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<notes>
    <note uri="/customers/X/notes/Y/" id="Y"/>
    [...]
</notes>

POST /api/customers/(d+)/notes/

Description:

Create a new note for the customer
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<note>
    <title>[str]</title>
    <note>[str]</note>
    <follow_up>[bool]</follow_up> <!-- Optional -->
    <follow_up_datetime>[datetime]</follow_up_datetime> <!-- Optional -->
</note>

Response:

<note uri="/customers/X/notes/Y/" id="Y">
    <!-- See GET /customers/X/notes/Y/ response for details. -->
</note>

/api/customers/(d+)/notes/(d+)/

GET /api/customers/(d+)/notes/(d+)/

Description:

Return a specific note for the customer
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<note uri="/customers/X/notes/Y/" id="Y">
    <title>[str]</title>
    <note>[str]</note>
    <datetime_created>[datetime]</datetime_created>
    <follow_up>[bool]</follow_up>
    <user uri="/users/Z/" id="Z"/>
</note>

PUT /api/customers/(d+)/notes/(d+)/

Description:

Update a note for the customer
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<note>
    <title>[str]</title> <!-- Optional -->
    <note>[str]</note> <!-- Optional -->
    <follow_up>[bool]</follow_up> <!-- Optional -->
    <follow_up_datetime>[datetime]</follow_up_datetime> <!-- Optional -->
</note>

Response:

<note uri="/customers/X/notes/Y/" id="Y">
    <!-- See GET /customers/X/notes/Y/ response for details. -->
</note>

DELETE /api/customers/(d+)/notes/(d+)/

Description:

Delete a customer note
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<!-- No XML Request -->

Response:

<note uri="/customers/X/notes/Y/" id="Y" deleted="true"/>