POST Exchange Mailbox
(Difference between revisions)
Revision as of 08:34, 20 May 2013
Create an Exchange mailbox
POST /accounts/{account_number}/exchange/{domain_name}/mailboxes
Contents |
Parameters
- account_number - string
- The account number that the Exchange resource belongs to
- domain_name - string
- The domain name that is associated with the Exchange resource
Request Body
{
"owner": {
"username": "john2",
"password": "secret2"
},
"admin": 0,
"notes": "some text",
"recipientLimit": 10,
"deliverRedirect": "zsds",
"forwardTo": "asdasd",
"name": {
"name": "John Smith",
"company": "My Company",
"department": "Sales",
"title": "President"
},
"address": {
"address": "100 Main St.",
"city": "Chicago",
"state": "IL",
"zip": "60001",
"country": "US"
},
"phones": {
"businessPhone": "555-555-5501",
"homePhone": "555-555-5502",
"fax": "555-555-5503",
"mobile": "555-555-5504"
}
}
- owner - dictionary
- -Contains attributes related to the mailbox user
- username - string
- -The handle of the mailbox that is to be created
- password - string
- -The password required to access the new mailbox
- admin - integer
- -Whether the mailbox user will have administrative privileges
- notes - string
- -User defined textual description
- recipientLimit - integer
- -Specifies the recipient limit for the mailbox. Allowed values are -1 or a positive integer
- deliverRedirect - string
- -Redirect address
- forwardTo - string
- -Forward address
- address - dictionary
- -Specifies the address details for the mailbox
- phones - dictionary
- -Specifies phone details for the mailbox
Response Codes
- 200
- Success
- 202
- Accepted
- 404
- Non-existent resource
- 405
- Unsupported method
- 409
- Duplicate entry
- 502
- Internal server error
Examples
POST {server_name}/accounts/{account_number}/exchange/{domain_name}/mailboxes
- Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
- Request Body:
{
"owner": {
"username": "test-username",
"password": "secret2"
},
"admin": 0,
"notes": "some text",
"recipientLimit": 10,
"deliverRedirect": "zsds",
"forwardTo": "asdasd",
"name": {
"name": "John Smith",
"company": "My Company",
"department": "Sales",
"title": "President"
},
"address": {
"address": "100 Main St.",
"city": "Chicago",
"state": "IL",
"zip": "60001",
"country": "US"
},
"phones": {
"businessPhone": "555-555-5501",
"homePhone": "555-555-5502",
"fax": "555-555-5503",
"mobile": "555-555-5504"
}
}
- Response: Accepted (202):
{
"status" : "New",
"orderid": "00000135eca7015025dce1a2000a2480a2f03088"
"orderProducts" : {
"href" : "http://{server_name}/orders/{order_id}/products",
"rel" : "related"
},
"links" : {
"href" : "http://{server_name}/accounts/accountnumber/exchange/{domain_name}/mailboxes",
"rel" : "self"
},
"orderAccount" : {
"account" : {
"href" : "http://{server_name}/accounts/{account_number}",
"rel" : "related"
}
}
"orderAction" : {
"href" : "http://{server_name}/orders/{order_id}/action",
"rel" : "related"
}
}
- Response when adding an optional mailbox: Success (202):
{
"total": ["8.00", "USD"],
"subtotal": ["8.00", "USD"],
"quotehash": "{quote_id}",
"links": [
{
"href": "http://{server_name}/accounts/{account_number}/exchange/{domain_name}/mailboxes/",
"rel": "self"
},
{
"href": "http://{server_name}/orders/{order_id}/action",
"rel": "related"
}
]
}
- Request Body with Invalid data:
{
"owner": {
"username": "(^%*&^*&^)*",
"password": "weakpass"
},
"admin": 0,
"notes": "",
"recipientLimit": 10,
"deliverRedirect": "zsds",
"forwardTo": "asdasd",
"name": {
"name": "John Smith",
"company": "My Company",
"department": "Sales",
"title": "President"
},
"address": {
"address": "100 Main St.",
"city": "Chicago",
"state": "IL",
"zip": "60001",
"country": "US"
},
"phones": {
"businessPhone": "555-555-5501",
"homePhone": "555-555-5502",
"fax": "555-555-5503",
"mobile": "555-555-5504"
}
}
- Response: BadRequest (400):
{
"badRequest": {"message": "POST data error", "code": 400,
"details": {"notes": "Required",
"owner.username": "Has invalid characters.Allowed are lower only letters, numbers, underscores, dashes",
"owner.password": "Must not contain only lower case letters"}
}
}