POST Exchange Global Contact

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
 
m (1 revision: Release 95)
 

Latest revision as of 23:59, 1 July 2014

Create an Exchange Global Contact

POST {server_name}/accounts/{account_number}/exchange/{domain_name}/globalContacts

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

 {
        "target": "{target_email}",
        "name": {
            "name": "John Jello",
            "company": "My Company",
            "department": "Sales",
            "title": "President"
        },
        "address": {
            "address": "100 Main St.",
            "city": "Chicago",
            "state": "IL",
            "zip": "60001",
            "country": "US"
        },
        "phones": {
            "homePhone": "87238473",
            "businessPhone": "555-555-5501",
            "fax": "555-555-5503",
            "mobile": "555-555-5504"
        },
        "notes": "Notes in here"
}
  
target - string
- A valid email address
name - dictionary
(OPTIONAL)
- Contains additional personal details about the contact
address - dictionary
(OPTIONAL)
- Contains additional address information about the contact
phones - dictionary
(OPTIONAL)
- Contains additional information about the contact's phone numbers

Expected Response Codes

201
Created
404
Non-existent resource
409
Global contact with that "target" email already exists.
405
Unsupported method
415
Validation error
502
Internal server error

Examples

POST {server_name}/accounts/account300021/exchange/ng-test-hwus-120120b.com/globalContacts

- Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

- Request Body:

{
        "target": "test@domain.com",
        "name": {
            "name": "John Jello",
            "company": "My Company",
            "department": "Sales",
            "title": "President"
        },
        "address": {
            "address": "100 Main St.",
            "city": "Chicago",
            "state": "IL",
            "zip": "60001",
            "country": "US"
        },
        "phones": {
            "homePhone": "87238473",
            "businessPhone": "555-555-5501",
            "fax": "555-555-5503",
            "mobile": "555-555-5504"
        },
        "notes": "Notes in here"
}
 

- Response: Created (201):

Server : nginx/0.6.32
Date : Wed, 11 Apr 2012 14:26:01 GMT
Content-Type : application/json; charset=UTF-8
Connection : keep-alive
Access-Control-Allow-Origin : *
Location : http://{server_name}/accounts/{account_number}/exchange/{domain_name}/globalContacts/{globalContactId}/
Content-Length : 3
  • There will be a Location in the response header pointing to the newly created resource. The {globalContactId} is generated on the backend.




- Request Body with Invalid data:

 
  {
        "target": "wrong!@email",
        "name": {
            "name": "",
            "company": "",
            "department": "",
            "title": ""
        }
  }
  
  • The name dictionary will not be updated because its values are empty. Same goes for all OPTIONAL dictionary entries in the post body.

- Response: BadRequest (400):

 
{
  "badRequest" : {
    "message" : "POST data error",
    "code" : 400,
    "details" : {
      "target" : "Invalid email address"
    }
  }
}
  




- Request Body with Conflict data:

 
  {
        "target": "test@domain.com"        
  }
  

- Response: Conflict (409):

409 Conflict
There was a conflict when trying to complete your request.
Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox