Contact
Add a new contact
Request:
POST /users/{user_id}/contacts
Accept: application/xml
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
Most of the elements above should be self explanatory, other than a few that are specific to Lypp:
- im
- The user's instant messaging account, eg: john.doe@hotmail.com
- im-network
- The user's instance mesaging network. Can be one of the following:
- aim
- xmpp
- msn
- yahoo
- time-zone
- The user's time zone. Can be one of the following:
- International Date Line West
- Midway Island
- Samoa
- Hawaii
- Alaska
- Pacific Time (US & Canada)
- Tijuana
- Arizona
- Chihuahua
- Mazatlan
- Mountain Time (US & Canada)
- Central America
- Central Time (US & Canada)
- Guadalajara
- Mexico City
- Monterrey
- Saskatchewan
- Bogota
- Eastern Time (US & Canada)
- Indiana (East)
- Lima
- Quito
- Atlantic Time (Canada)
- Caracas
- La Paz
- Santiago
- Newfoundland
- Brasilia
- Buenos Aires
- Georgetown
- Greenland
- Mid-Atlantic
- Azores
- Cape Verde Is.
- Casablanca
- Dublin
- Edinburgh
- Lisbon
- London
- Monrovia
- UTC
- Amsterdam
- Belgrade
- Berlin
- Bern
- Bratislava
- Brussels
- Budapest
- Copenhagen
- Ljubljana
- Madrid
- Paris
- Prague
- Rome
- Sarajevo
- Skopje
- Stockholm
- Vienna
- Warsaw
- West Central Africa
- Zagreb
- Athens
- Bucharest
- Cairo
- Harare
- Helsinki
- Istanbul
- Jerusalem
- Kyev
- Minsk
- Pretoria
- Riga
- Sofia
- Tallinn
- Vilnius
- Baghdad
- Kuwait
- Moscow
- Nairobi
- Riyadh
- St. Petersburg
- Volgograd
- Tehran
- Abu Dhabi
- Baku
- Muscat
- Tbilisi
- Yerevan
- Kabul
- Ekaterinburg
- Islamabad
- Karachi
- Tashkent
- Chennai
- Kolkata
- Mumbai
- New Delhi
- Kathmandu
- Almaty
- Astana
- Dhaka
- Novosibirsk
- Sri Jayawardenepura
- Rangoon
- Bangkok
- Hanoi
- Jakarta
- Krasnoyarsk
- Beijing
- Chongqing
- Hong Kong
- Irkutsk
- Kuala Lumpur
- Perth
- Singapore
- Taipei
- Ulaan Bataar
- Urumqi
- Osaka
- Sapporo
- Seoul
- Tokyo
- Yakutsk
- Adelaide
- Darwin
- Brisbane
- Canberra
- Guam
- Hobart
- Melbourne
- Port Moresby
- Sydney
- Vladivostok
- Magadan
- New Caledonia
- Solomon Is.
- Auckland
- Fiji
- Kamchatka
- Marshall Is.
- Wellington
- Nuku'alofa
Response:
201 Created
Content-Type: application/xml
Location: /users/{user_id}/contacts/{contact_id}
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<id type="integer">{contact_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">{phone_number_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
Example:
curl \
-X POST \
-u username:password \
-H 'Accept: application/xml' \
-H 'Content-Type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<contact>
<name>John Doe</name>
<email>test@example.com</email>
<im>john.doe@hotmail.com</im>
<im-network>msn</im-network>
<time-zone>Pacific Time (US & Canada)</time-zone>
<phone-numbers type="array">
<phone-number>
<country-code>1</country-code>
<subscriber-number>6045555555</subscriber-number>
<location>home</location>
<extension>1</extension>
</phone-number>
</phone-numbers>
</contact>' \
http://lypp.com/users/1/contacts
List all contacts
Request:
GET /users/{user_id}/contacts
Accept: application/xml
Response:
200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<contacts type="array">
<contact>
<id type="integer">{contact_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">{phone_number_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
...
</contacts>
Example:
curl \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1/contacts
Show a contact
Request:
GET /users/{user_id}/contacts/{contact_id}
Accept: application/xml
Response:
200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<id type="integer">{contact_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">{phone_number_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
Example:
curl \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1/contacts/2
Update a contact
Request:
PUT /users/{user_id}/contacts/{contact_id}
Accept: application/xml
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">{phone_number_id}</id>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
Response:
200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<id type="integer">{contact_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<name>{name}</name>
<email>{email}</email>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">{phone_number_id}</id>
<created-at type="datetime">{created_at}</created-at>
<updated-at type="datetime">{updated_at}</updated-at>
<lock-version type="integer">{lock_version}</lock-version>
<country-code type="integer">{country_code}</country-code>
<subscriber-number>{subscriber_number}</subscriber-number>
<location>{location}</location>
<extension>{extension}</extension>
</phone-number>
</phone-numbers>
</contact>
Example:
curl \
-X PUT \
-u username:password \
-H 'Accept: application/xml' \
-H 'Content-Type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<contact>
<name>John Doe</name>
<email>test@example.com</email>
<im>john.doe@hotmail.com</im>
<im-network>msn</im-network>
<time-zone>Pacific Time (US & Canada)</time-zone>
<phone-numbers type="array">
<phone-number>
<id type="integer">1</id>
<country-code>1</country-code>
<subscriber-number>6045555555</subscriber-number>
<location>home</location>
<extension>1</extension>
</phone-number>
</phone-numbers>
</contact>' \
http://lypp.com/users/1/contacts/2
Delete a contact
Request:
DELETE /users/{user_id}/contacts/{contact_id}
Accept: application/xml
Response:
204 No Content
Example:
curl \
-X DELETE \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1/contacts/2
