api.customers¶
- /api/customers/
- /api/customers/(d+)/
- /api/customers/(d+)/ar_balance/
- /api/customers/(d+)/contacts/
- /api/customers/(d+)/contacts/(d+)/
- /api/customers/(d+)/credit_status/
- /api/customers/(d+)/customer_photo/
- /api/customers/(d+)/notes/
- /api/customers/(d+)/notes/(d+)/
- /api/customers/search/
/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"/>
/api/customers/search/¶
Data¶
Columns
name | type | required | default | sort_default | can_summarize |
---|---|---|---|---|---|
lsserver.search.column.id | STRING | False | False | False | False |
lsserver.search.column.name | STRING | False | True | True | False |
lsserver.search.column.email | STRING | False | True | False | False |
lsserver.search.column.phone | STRING | False | True | False | False |
lsserver.search.column.account_status | STRING | False | False | False | False |
lsserver.search.column.category | STRING | False | False | False | False |
lsserver.search.column.city | STRING | False | False | False | False |
lsserver.search.column.country | STRING | False | False | False | False |
lsserver.search.column.salesperson | STRING | False | False | False | False |
lsserver.search.column.state_province | STRING | False | False | False | False |
lsserver.search.column.company | STRING | False | False | False | False |
lsserver.search.column.customer_custom_field_0 | STRING/DATE/BOOLEAN | False | False | False | False |
Filters
name | type | required | enum_values |
---|---|---|---|
lsserver.search.filters.account_status | STRING | False | None |
lsserver.search.filters.address | STRING | False | None |
lsserver.search.filters.customer | STRING | False | None |
lsserver.search.filters.category | STRING | False | None |
lsserver.search.filters.city | STRING | False | None |
lsserver.search.filters.country | STRING | False | None |
lsserver.search.filters.currency | STRING | False | None |
lsserver.search.filters.customer_id | STRING | False | None |
lsserver.search.filters.created_date | DATE | False | None |
lsserver.search.filters.email | STRING | False | None |
lsserver.search.filters.groups | STRING | False | None |
lsserver.search.filters.home_page | STRING | False | None |
lsserver.search.filters.company | BOOLEAN | False | None |
lsserver.search.filters.name | STRING | False | None |
lsserver.search.filters.new_import | BOOLEAN | False | None |
lsserver.search.filters.new_updates | BOOLEAN | False | None |
lsserver.search.filters.notes | STRING | False | None |
lsserver.search.filters.merged | BOOLEAN | False | None |
lsserver.search.filters.modified_date | DATE | False | None |
lsserver.search.filters.phone | STRING | False | None |
lsserver.search.filters.referred_by | STRING | False | None |
lsserver.search.filters.salesperson | STRING | False | None |
lsserver.search.filters.state_province | STRING | False | None |
lsserver.search.filters.tax_code | STRING | False | None |
lsserver.search.filters.tax_status | STRING | False | None |
lsserver.search.filters.terms | STRING | False | None |
lsserver.search.filters.zip_postal_code | STRING | False | None |
lsserver.search.filters.customer_custom_field_0 | STRING/DATE/BOOLEAN | False | None |
GET /api/customers/search/¶
can_lock | requires_lock | has_etag | requires_etag |
---|---|---|---|
False | False | False | False |
Request:
<!-- No XML Request. -->
Response:
<search_criteria>
<columns>
<column id="[str]">
<name>
<localizable_message/> <!-- mutually exclusive with <raw> -->
<raw>[str]</raw><!-- mutually exclusive with <localizable_message> -->
</name> <!-- The localizable name of this column -->
<type>[enum: STRING | INTEGER | DECIMAL | MONEY | DATE | DATETIME | BOOLEAN]</type>
<required>[bool]</required><!-- Indicates that this item must be part of the query -->
<default>[bool]</default><!-- Indicates which columns should be selected by default -->
<sort_default>[bool]</sort_default><!-- Indicates that this column should be selected as the sort column by default -->
<sort_default_order_by>[enum: ASC | DESC]</sort_default_order_by><!-- Indicates what the default order by should be for this column -->
<can_summarize>[bool]</can_summarize><!-- Indicates that this column can be used to generate a summarized total -->
</column>
[...]
</columns>
<filters>
<filter id="[str]">
<name>
<localizable_message/> <!-- mutually exclusive with <raw> -->
<raw>[str]</raw><!-- mutually exclusive with <localizable_message> -->
</name> <!-- The localizable name of this filter -->
<type>[enum: ENUM | STRING | INTEGER | DECIMAL | MONEY | DATE | DATETIME | BOOLEAN ]</type><!-- Defines the type of data this filter represents -->
<enum_values><!-- Present if and only if type is ENUM -->
<enum_value>
<name>
<localizable_message/> <!-- Mutually exclusive with <raw> -->
<raw>[str]</raw> <!-- Mutually exclusive with <localizable_message> -->
</name> <!-- The name to be displayed -->
<value>[str]</value> <!-- The value to be passed to the server in <filters> of a POST -->
</enum_value>
[...]
</enum_values>
</filter>
[...]
</filters>
</search_criteria>
POST /api/customers/search/¶
Description:
Executes a search based on the content of the post. Responses are streamed to
the client.
Note: Read only clients may POST searches.
can_lock | requires_lock | has_etag | requires_etag |
---|---|---|---|
False | False | False | False |
Request:
<search>
<include_total>[bool]</include_total> <!-- True by default -->
<page> <!-- optional if getting the whole dataset -->
<offset>[int]</offset> <!-- optional -->
<count>[int]</count> <!-- optional -->
</page>
<summarized_column><!-- Optional. When specified, a summarized total is added to the data -->
<column id="[str]"/>
</summarized_column>
<search_query>
<columns><!-- optional. If no columns are specified, the default columns are selected.-->
<column id="[str]"/>
[...]
</columns>
<sort_by_column><!-- optional. If not specified, the default columns is used for sorting. -->
<column id="[str]"/>
<order_by>[enum: ASC | DESC]</order_by><!-- Optional. If not specified the default order by is used.-->
</sort_by_column>
<filters><!-- optional or content optional-->
<!--
Predicate search based on the filter list from the GET
Predicate searches take the form of:
lsserver.search.column.fictional_column > 10 AND (lsserver.search.column.fictional_column2 == 0 OR lsserver.search.column.fictional_column3 != 0)
-->
</filters>
</search_query>
</search>
Response:
<data>
<info>
<total_count>[int]</total_count>
<summarized_column>
<column>
<name>
<localizable_message/> <!-- mutually exclusive with <raw> -->
<raw>[str]</raw><!-- mutually exclusive with <localizable_message> -->
</name>
<type>[enum: INTEGER | DECIMAL | MONEY ]</type>
</column>
</summarized_column>
<summarized_total>[int|decimal]</summarized_total>
</info>
<columns>
<column>
<name>
<localizable_message/> <!-- mutually exclusive with <raw> -->
<raw>[str]</raw><!-- mutually exclusive with <localizable_message> -->
</name>
<type>[enum: STRING | INTEGER | DECIMAL | MONEY | DATE | DATETIME | BOOLEAN]</type>
</column>
[...]
</columns>
<rows>
<row>
<links> <!-- Links to relevant documents -->
<link>
<product uri="" id="" />
</link>
[...]
</links>
<cell>
<type>[enum: STRING | INTEGER | DECIMAL | MONEY | DATE | DATETIME | BOOLEAN]</type>
<value>[str | int | decimal | date | datetime | bool]</value>
</cell>
[...] <!-- The count will always match the column count -->
</row>
</rows>
</data>