Difference between revisions of "Customer (Rest API)"
m (moved RestAPI/Customer to Customer (Rest API)) |
(Updated to reflect latest version.) |
||
| Line 7: | Line 7: | ||
''URL'': | ''URL'': | ||
| − | [GET] <nowiki> | + | [GET] <nowiki>https://api.emailsrvr.com/v0/customers</nowiki> |
| Line 32: | Line 32: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| − | <customerList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customerList"> | + | <customerList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| + | xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customerList"> | ||
<offset>0</offset> | <offset>0</offset> | ||
<size>50</size> | <size>50</size> | ||
| Line 57: | Line 58: | ||
| − | '' | + | ''JSON Result Example'': |
| − | {"offset":0,"size":50,"total":3,"customers":[{"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"},{"name":"API Customer 39","accountNumber":"460181","referenceNumber":"23"},{"name":"API Customer 50","accountNumber":"460183","referenceNumber":"10"}]} | + | <pre> |
| − | + | {"offset":0,"size":50,"total":3,"customers": | |
| − | + | [{"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"}, | |
| − | + | {"name":"API Customer 39","accountNumber":"460181","referenceNumber":"23"}, | |
| − | + | {"name":"API Customer 50","accountNumber":"460183","referenceNumber":"10"}]} | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| Line 79: | Line 72: | ||
''URL'': | ''URL'': | ||
| − | [GET] <nowiki> | + | [GET] <nowiki>https://api.emailsrvr.com/v0/customers/(customer account number)</nowiki> |
| Line 89: | Line 82: | ||
''Remarks'': | ''Remarks'': | ||
| − | To do the show operation on the account that is logged in instead of a customer's account, use "me" in the place of the customer account number i.e. <nowiki>' | + | To do the show operation on the account that is logged in instead of a customer's account, use "me" in the place of the customer account number i.e. <nowiki>'https://api.emailsrvr.com/v0/customers/me'</nowiki>. |
The show operation only supports the GET HTTP verb. For text/xml format, refer to the following schema document: [http://api.emailsrvr.com/v0/Schemas/Customer.xsd Customer.xsd] | The show operation only supports the GET HTTP verb. For text/xml format, refer to the following schema document: [http://api.emailsrvr.com/v0/Schemas/Customer.xsd Customer.xsd] | ||
| Line 105: | Line 98: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| − | <customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customer"> | + | <customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| + | xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customer"> | ||
<name>API Customer 17</name> | <name>API Customer 17</name> | ||
<accountNumber>460182</accountNumber> | <accountNumber>460182</accountNumber> | ||
| Line 113: | Line 107: | ||
| − | '' | + | ''JSON Result Example'': |
| + | <pre> | ||
{"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"} | {"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"} | ||
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| Line 139: | Line 118: | ||
''URL'': | ''URL'': | ||
| − | Add: [POST] <nowiki> | + | Add: [POST] <nowiki>https://api.emailsrvr.com/customers</nowiki> |
| − | Edit: [PUT] <nowiki> | + | Edit: [PUT] <nowiki>https://api.emailsrvr.com/customers/(customer account number)</nowiki> |
| Line 148: | Line 127: | ||
| − | {| | + | {| class="wikitable" |
!''Field Name'' | !''Field Name'' | ||
!''Data Type'' | !''Data Type'' | ||
!''Description'' | !''Description'' | ||
| − | |- | + | |- |
| name | | name | ||
| string | | string | ||
| The customer's display name (Required for Add) | | The customer's display name (Required for Add) | ||
| − | |- | + | |- |
| referenceNumber | | referenceNumber | ||
| string | | string | ||
| Line 168: | Line 147: | ||
post '/customers', 'text/xml', | post '/customers', 'text/xml', | ||
{ | { | ||
| − | 'name' => 'Name' | + | 'name' => 'Name' |
} | } | ||
</pre> | </pre> | ||
| Line 176: | Line 155: | ||
{ | { | ||
'name' => 'NewName', | 'name' => 'NewName', | ||
| − | 'referenceNumber' => '12345' | + | 'referenceNumber' => '12345' |
} | } | ||
</pre> | </pre> | ||
| Line 183: | Line 162: | ||
''Errors'': | ''Errors'': | ||
| − | {| | + | {| class="wikitable" |
!''Description'' | !''Description'' | ||
!''HTTP Response Code'' | !''HTTP Response Code'' | ||
!''Sample Message'' | !''Sample Message'' | ||
| − | + | |- | |
| − | |||
| − | |||
| − | |||
| − | |- | ||
| The name field was not specified | | The name field was not specified | ||
| 400 | | 400 | ||
| Missing required field: name | | Missing required field: name | ||
| − | |- | + | |- |
| The name field cannot be blank | | The name field cannot be blank | ||
| 400 | | 400 | ||
| Required field name cannot be empty | | Required field name cannot be empty | ||
| − | |- | + | |- |
| Names cannot start with a space | | Names cannot start with a space | ||
| 400 | | 400 | ||
| Improper Customer Name | | Improper Customer Name | ||
| − | |||
| − | |||
| − | |||
| − | |||
|} | |} | ||
| Line 214: | Line 185: | ||
''URL'': | ''URL'': | ||
| − | [DELETE] <nowiki> | + | [DELETE] <nowiki>https://api.emailsrvr.com/customers/(customer account number)</nowiki> |
| Line 227: | Line 198: | ||
delete '/customers/999999', 'text/xml' | delete '/customers/999999', 'text/xml' | ||
</pre> | </pre> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revision as of 11:18, 30 November 2009
Contents
Index
URL:
[GET] https://api.emailsrvr.com/v0/customers
Description:
This operation returns the list of customers that the authenticated user has access to.
Remarks:
For the text/xml format, refer to the following schema document: CustomerList.xsd
Example:
get '/customers?size=100&page=1', 'text/xml'
XML Result Example:
<?xml version="1.0" encoding="utf-8"?>
<customerList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customerList">
<offset>0</offset>
<size>50</size>
<total>3</total>
<customers>
<customer>
<name>API Customer 17</name>
<accountNumber>460182</accountNumber>
<referenceNumber>49</referenceNumber>
</customer>
<customer>
<name>API Customer 39</name>
<accountNumber>460181</accountNumber>
<referenceNumber>23</referenceNumber>
</customer>
<customer>
<name>API Customer 50</name>
<accountNumber>460183</accountNumber>
<referenceNumber>10</referenceNumber>
</customer>
</customers>
</customerList>
JSON Result Example:
{"offset":0,"size":50,"total":3,"customers":
[{"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"},
{"name":"API Customer 39","accountNumber":"460181","referenceNumber":"23"},
{"name":"API Customer 50","accountNumber":"460183","referenceNumber":"10"}]}
Show
URL:
[GET] https://api.emailsrvr.com/v0/customers/(customer account number)
Description:
The show operation will return detailed information about the specified account.
Remarks:
To do the show operation on the account that is logged in instead of a customer's account, use "me" in the place of the customer account number i.e. 'https://api.emailsrvr.com/v0/customers/me'.
The show operation only supports the GET HTTP verb. For text/xml format, refer to the following schema document: Customer.xsd
Example:
get '/customers/me', 'text/xml'
XML Result Example:
<?xml version="1.0" encoding="utf-8"?> <customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xml:customer"> <name>API Customer 17</name> <accountNumber>460182</accountNumber> <referenceNumber>49</referenceNumber> </customer>
JSON Result Example:
{"name":"API Customer 17","accountNumber":"460182","referenceNumber":"49"}
Add/Edit
URL:
Add: [POST] https://api.emailsrvr.com/customers Edit: [PUT] https://api.emailsrvr.com/customers/(customer account number)
Description:
Add/Edit a new sub-account. Note that customer number is not known until the customer is added.
| Field Name | Data Type | Description |
|---|---|---|
| name | string | The customer's display name (Required for Add) |
| referenceNumber | string | The reference number of this account |
Example:
post '/customers', 'text/xml',
{
'name' => 'Name'
}
put '/customers/999999', 'text/xml',
{
'name' => 'NewName',
'referenceNumber' => '12345'
}
Errors:
| Description | HTTP Response Code | Sample Message |
|---|---|---|
| The name field was not specified | 400 | Missing required field: name |
| The name field cannot be blank | 400 | Required field name cannot be empty |
| Names cannot start with a space | 400 | Improper Customer Name |
Delete
URL:
[DELETE] https://api.emailsrvr.com/customers/(customer account number)
Description:
Deletes the account.
Example:
delete '/customers/999999', 'text/xml'