Endeve - Developers Area

Contacts

A contact represents a customer or a provider.

Every contact has values for the attributes first_name, region_id and language_id. first_name represents the contact Name or Corporate name. region_id represents the contact region identifier. In endeve, regions, countries and languages are standardized, so the value of these attributes has to be a valid one. You can access the list of regions, languages and countries through their respective API URLs.

SHOW

GET /contacts/#{id}.xml

Returns a contact.

RESPONSE

Status: 200

<contact>
<account-id>4127</account-id>
<address>1 Infinite Loop</address>
<bank-account-number>00000000000000000000</bank-account-number>
<city>Cupertino</city>
<contact-person>Steve Jobs</contact-person>
<created-at>2010-03-08T11:38:43Z</created-at>
<delivery-address>1 Infinite Loop</delivery-address>
<delivery-city>Cupertino</delivery-city>
<delivery-phone1>+1 000 000 000</delivery-phone1>
<delivery-phone2>+1 111 111 111</delivery-phone2>
<delivery-postal-code>95014</delivery-postal-code>
<delivery-region-id>1749</delivery-region-id>
<discount-rate>10.0</discount-rate>
<email>info@apple.com</email>
<fax>+1 222 222 222</fax>
<first-name>Apple Computer</first-name>
<id type=“integer”>13894</id>
<language-id>38</language-id>
<last-name/>
<notes></notes>
<phone1>+1 000 000 000</phone1>
<phone2>+1 111 111 111</phone2>
<postal-code>95014</postal-code>
<region-id>1749</region-id>
<sales-count>0</sales-count>
<updated-at>2010-03-26T12:32:28Z</updated-at>
<vat-number>B35000000</vat-number>
<web>http://www.endeve.com</web>
</contact>

The meaning of each attribute is specified in the data reference section.

LIST

GET /contacts.xml?q=#{criteria}&page=#{page}&per_page=#{per_page}

Returns a collection of contacts arranged by name in alphabetical order. In the main node, you’ll find the total number of contacts in the attributes count. For each contact the following attributes are returned: email, first-name, id, last-name, phone1, phone2 and sales-count. All request parameters are optional.

RESPONSE

Status: 200

<contacts>
<contact>

</contact>

<contact>

</contact>

<contact>

</contact>
</contacts>

You can search by name passing the q parameter through URL. By default, this parameter is set to an empty string ("").

The response is paginated and by default only the first 10 contacts are returned. If you wish to see the next 10 contacts, you can use the page parameter, specifying the page you want to see. By default, this parameter is set to 1.

To increase the number of results returned on a page, use the per_page parameter. By default, this parameter is set to 10. You can get a maximum of 50 contacts per page.

CREATE

POST /contacts.xml

Create a new contact.

The XML for the new user is returned on a successful request. first-name, region-id and language-id are mandatory attributes. If you don’t specify a value for region-id and language-id attributes, these will automatically be set to the values that appear in your account.

REQUEST

<contact>
<address>1 Infinite Loop</address>
<city>Cupertino</city>
<email>info@apple.com</email>
<first-name>Apple Computer</first-name>
<language-id>38</language-id>
<region-id>1749</region-id>
<vat-number>B35000000</vat-number>
<web>http://www.apple.com</web>
</contact>

RESPONSE

Status: 201

Location: https://www.endeve.com/contacts/#{id-nuevo-contacto}.xml

UPDATE

PUT /contacts/#{id}.xml

Updates an existing contact with new details from the submitted XML.

REQUEST

<contact>
<id>500</id>
<city>BerlĂ­n</city>
<region-id>735</region-id>
</contact>

RESPONSE

Status: 200

Location: https://www.endeve.com/contacts/5.xml

DELETE

DELETE /contacts/#{id}.xml

Deletes the contact at the referenced URL.

When you destroy a contact, all associated resources are destroyed too (invoices, expenses, estimates and recurrings).

RESPONSE

Status: 200