User
Add a new user
Request:
POST /users/
Accept: application/xml
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<name>{name}</name>
<email>{email}</email>
<password>{password}</password>
<password-confirmation>{password_confirmation}</password-confirmation>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<terms-of-service>{terms_of_service}</terms-of-service>
<credit-card>
<name>{name}</name>
<expiry-month type="integer">{expiry_month}</expiry-month>
<expiry-year type="integer">{expiry_year}</expiry-year>
<number>{number}</number>
<security-code>{security_code}</security-code>
</credit-card>
<address>
<street-address>{street_address}</street-address>
<postal-code>{postal_code}</postal-code>
<location>{location}</location>
<subdivision>{subdivision}</subdivision>
<country>{country}</country>
</address>
<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>
<billing-package>
<id>{billing_package_id}</id>
</billing-package>
</user>
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
Note: The timezone must be escaped. For example ampersands ("&") should be escaped to "&".
- terms-of-service
- When true the user has accepted the terms of service. This must be true in order for a user to be created.
- subdivision
- This is the state or province 2 letter code, eg. BC, WA or CA for British Columbia, Washington State, and California respectively.
- country
- This is the country 2 letter code. Can be either CA or US.
Response:
201 Created
Content-Type: application/xml
Location: /users/{user_id}
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id type="integer">{user_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>
<member-pin>{member_pin}</member-pin>
<moderator-pin>{moderator_pin}</moderator-pin>
<terms-of-service type="boolean">{terms_of_service}</terms-of-service>
<credit-card>
<id type="integer">{credit_card_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>
<expiry-month type="integer">{expiry_month}</expiry-month>
<expiry-year type="integer">{expiry_year}</expiry-year>
</credit-card>
<address>
<id type="integer">{address_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>
<street-address>{street_address}</street-address>
<postal-code>{postal_code}</postal-code>
<location>{location}</location>
<subdivision>{subdivision}</subdivision>
<country>{country}</country>
</address>
<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>
</user>
Example:
curl \
-X POST \
-H 'Accept: application/xml' \
-H 'Content-Type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<user>
<name>John Doe</name>
<email>test@example.com</email>
<password>its a secret</password>
<password-confirmation>its a secret</password-confirmation>
<im>john.doe@hotmail.com</im>
<im-network>msn</im-network>
<time-zone>Pacific Time (US & Canada)</time-zone>
<terms-of-service>true</terms-of-service>
<credit-card>
<name>John Doe</name>
<number>378282246310005</number>
<expiry-month>01</expiry-month>
<expiry-year>2015</expiry-year>
<security-code>123</security-code>
</credit-card>
<address>
<street-address>123 Main St.</street-address>
<postal-code>54321</postal-code>
<location>Anytown</location>
<subdivision>WA</subdivision>
<country>US</country>
</address>
<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>
<billing-package>
<id>6</id>
</billing-package>
</user>' \
http://lypp.com/users
Show a user
Request:
GET /users/{user_id}
Accept: application/xml
Response:
200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id type="integer">{user_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>
<member-pin>{member_pin}</member-pin>
<moderator-pin>{moderator_pin}</moderator-pin>
<terms-of-service type="boolean">{terms_of_service}</terms-of-service>
<credit-card>
<id type="integer">{credit_card_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>
<expiry-month type="integer">{expiry_month}</expiry-month>
<expiry-year type="integer">{expiry_year}</expiry-year>
</credit-card>
<address>
<id type="integer">{address_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>
<street-address>{street_address}</street-address>
<postal-code>{postal_code}</postal-code>
<location>{location}</location>
<subdivision>{subdivision}</subdivision>
<country>{country}</country>
</address>
<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>
</user>
Example:
curl \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1
Update a user
Request:
PUT /users/{user_id}
Accept: application/xml
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<name>{name}</name>
<email>{email}</email>
<password>{password}</password>
<password-confirmation>{password_confirmation}</password-confirmation>
<im>{im}</im>
<im-network>{im_network}</im-network>
<time-zone>{time_zone}</time-zone>
<credit-card>
<name>{name}</name>
<expiry-month type="integer">{expiry_month}</expiry-month>
<expiry-year type="integer">{expiry_year}</expiry-year>
<number>{number}</number>
<security-code>{security_code}</security-code>
</credit-card>
<address>
<street-address>{street_address}</street-address>
<postal-code>{postal_code}</postal-code>
<location>{location}</location>
<subdivision>{subdivision}</subdivision>
<country>{country}</country>
</address>
<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>
<billing-package>
<id>{billing_package_id}</id>
</billing-package>
</user>
Response:
200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id type="integer">{user_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>
<member-pin>{member_pin}</member-pin>
<moderator-pin>{moderator_pin}</moderator-pin>
<terms-of-service type="boolean">{terms_of_service}</terms-of-service>
<credit-card>
<id type="integer">{credit_card_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>
<expiry-month type="integer">{expiry_month}</expiry-month>
<expiry-year type="integer">{expiry_year}</expiry-year>
</credit-card>
<address>
<id type="integer">{address_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>
<street-address>{street_address}</street-address>
<postal-code>{postal_code}</postal-code>
<location>{location}</location>
<subdivision>{subdivision}</subdivision>
<country>{country}</country>
</address>
<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>
</user>
Example:
curl \
-X PUT \
-u username:password \
-H 'Accept: application/xml' \
-H 'Content-Type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<user>
<name>John Doe</name>
<email>test@example.com</email>
<password>its a secret</password>
<password-confirmation>its a secret</password-confirmation>
<im>john.doe@hotmail.com</im>
<im-network>msn</im-network>
<time-zone>Pacific Time (US & Canada)</time-zone>
<credit-card>
<name>John Doe</name>
<number>378282246310005</number>
<expiry-month>01</expiry-month>
<expiry-year>2015</expiry-year>
</credit-card>
<address>
<street-address>123 Main St.</street-address>
<postal-code>54321</postal-code>
<location>Anytown</location>
<subdivision>WA</subdivision>
<country>US</country>
</address>
<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>
<billing-package>
<id>6</id>
</billing-package>
</user>' \
http://lypp.com/users/1
