Accounts-accountId-Contacts:PUT
From Hostway API Documentation
				
								
				Revision as of 01:34, 8 May 2014 by Mike.robski  (Talk | contribs)
				
			PUT /accounts/{accountId}/contacts
Set the contact details for an account
Contents | 
Request
PUT /accounts/{accountId}/contacts
Parameters
- accountId - string
 - The Id of the account.
 
URI Parameters
None.
Request Headers
- Authorization - HTTP Authorization header [1]
 - The Authentication credentials of the client application.
 
Request Body
{
  "regular": {
    "city": "{city}",
    "company": "{company}",
    "countryCode": "{countryCode}",
    "email1": "{email1}",
    "email2": "{email2}",
    "fax": "{fax}",
    "firstName": "{firstName}",
    "lastName": "{lastName}",
    "middleName": "{middleName}",
    "phone1": "{phone1}",
    "phone2": "{phone2}",
    "postalCode": "{postalCode}",
    "salutation": "{salutation}",
    "stateOrProvince": "{stateOrProvince}",
    "street1": "{street1}",
    "street2": "{street2}"
  },
  "billing": {
    "city": "{city}",
    "company": "{company}",
    "countryCode": "{countryCode}",
    "email1": "{email1}",
    "email2": "{email2}",
    "fax": "{fax}",
    "firstName": "{firstName}",
    "lastName": "{lastName}",
    "middleName": "{middleName}",
    "phone1": "{phone1}",
    "phone2": "{phone2}",
    "postalCode": "{postalCode}",
    "salutation": "{salutation}",
    "stateOrProvince": "{stateOrProvince}",
    "street1": "{street1}",
    "street2": "{street2}"
  },
  "administrator": {
    "city": "{city}",
    "company": "{company}",
    "countryCode": "{countryCode}",
    "email1": "{email1}",
    "email2": "{email2}",
    "fax": "{fax}",
    "firstName": "{firstName}",
    "lastName": "{lastName}",
    "middleName": "{middleName}",
    "phone1": "{phone1}",
    "phone2": "{phone2}",
    "postalCode": "{postalCode}",
    "salutation": "{salutation}",
    "stateOrProvince": "{stateOrProvince}",
    "street1": "{street1}",
    "street2": "{street2}"
  },
  "technical": {
    "city": "{city}",
    "company": "{company}",
    "countryCode": "{countryCode}",
    "email1": "{email1}",
    "email2": "{email2}",
    "fax": "{fax}",
    "firstName": "{firstName}",
    "lastName": "{lastName}",
    "middleName": "{middleName}",
    "phone1": "{phone1}",
    "phone2": "{phone2}",
    "postalCode": "{postalCode}",
    "salutation": "{salutation}",
    "stateOrProvince": "{stateOrProvince}",
    "street1": "{street1}",
    "street2": "{street2}"
  }
}
 
Parameters
Note, there are 4 types of contact information that must be sent with the request: "regular", "billing", "administrator" and "technical". All 4 are required.
- city - string
 - (REQUIRED)
 - May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 
- company - string
 - (OPTIONAL)
 - May be up to 200 characters long. May contain only alphanumerics, white space and the following characters: -.'
 
- countryCode - string
 - (REQUIRED)
 - ISO 3166-1 alpha-2[2] country code.
 
- email1 - string
 - (REQUIRED)
 - May be up to 100 characters long. Must contain a valid e-mail address.
 
- email2 - string
 - (OPTIONAL)
 - May be up to 100 characters long. If provided, must contain a valid e-mail address.
 
- fax - string
 - (OPTIONAL)
 - May be up to 20 characters long. If provided, must contain ITU-T E.164[3] formatted phone number.
 
- firstName - string
 - (REQUIRED)
 - May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 
- lastName - string
 - (REQUIRED)
 - May be up to 50 characters long. May contain only alphanumerics, white space and the following characters: -.'
 
- middleName - string
 - (OPTIONAL)
 - May be up to 50 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'
 
- phone1 - string
 - (REQUIRED)
 - May be up to 20 characters long. Must contain ITU-T E.164[4] formatted phone number.
 
- phone2 - string
 - (OPTIONAL)
 - May be up to 20 characters long. If provided, must contain ITU-T E.164[5] formatted phone number.
 
- postalCode - string
 - (OPTIONAL)
 - May be up to 30 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of countryCode is "US" or "CA". If the value of countryCode is "US", then postalCode must be in format "#####" or "#####-####" (where "#" represents any numeric digit). If the value of countryCode is "CA", then postalCode must be in format "A#A#A#" or "A#A-#A#" or "A#A #A#" (where "A" represents any latin alphabet character and "#" represents any numeric digit).
 
- salutation - string
 - (OPTIONAL)
 - May contain one of the salutations provided by GET /salutations
 
- stateOrProvince - string
 - (OPTIONAL)
 - May be up to 20 characters long. May contain only alphanumerics, white space and the following characters: -.' This value is *required* if the value of countryCode is "US" or "CA". If the value of countryCode is "US", then stateOrProvince must be a valid two-letter US state abbreviation. If the value of countryCode is "CA", then stateOrProvince must be a valid two-letter Canadian province abbreviation.
 
- street1 - string
 - (REQUIRED)
 - May be up to 100 characters long. May contain only alphanumerics, white space and the following characters: -.'
 
- street2 - string
 - (OPTIONAL)
 - May be up to 100 characters long. If provided, may contain only alphanumerics, white space and the following characters: -.'
 
Response
Status Code
- 204 No Content
 - Successfully updated contact information
 
- 400 Bad Request
 - Contact information was not updated because either the request body was malformed, or some element of the request body did not meet the requirements.
 
- 401 Unauthorized
 - The request was sent without an Authorization header, or the user represented by the value of this header was not properly authenticated.
 
- 403 Forbidden
 - The user authenticated for this request is not allowed to access the resource.
 
- 404 Not Found
 - The account Id was not found.
 
Response Body
None.
Examples
Successful update of contact information
Request
PUT /accounts/{accountId}/contacts
Authorization: Basic {Base64-encoded username & password string}
{
  "regular": {
    "city": "Chicago",
    "company": "TestCo, Inc.",
    "countryCode": "US",
    "email1": "test@test.com",
    "email2": "",
    "fax": "",
    "firstName": "John",
    "lastName": "Smith",
    "middleName": "",
    "phone1": "555-555-5501",
    "phone2": "",
    "postalCode": "60001",
    "salutation": "Mr.",
    "stateOrProvince": "IL",
    "street1": "100 Main St.",
    "street2": ""
  },
  "billing": {
    "city": "Chicago",
    "company": "TestCo, Inc.",
    "countryCode": "US",
    "email1": "test@test.com",
    "email2": "",
    "fax": "",
    "firstName": "John",
    "lastName": "Smith",
    "middleName": "",
    "phone1": "555-555-5501",
    "phone2": "",
    "postalCode": "60001",
    "salutation": "Mr.",
    "stateOrProvince": "IL",
    "street1": "100 Main St.",
    "street2": ""
  },
  "administrator": {
    "city": "Chicago",
    "company": "TestCo, Inc.",
    "countryCode": "US",
    "email1": "test@test.com",
    "email2": "",
    "fax": "",
    "firstName": "John",
    "lastName": "Smith",
    "middleName": "",
    "phone1": "555-555-5501",
    "phone2": "",
    "postalCode": "60001",
    "salutation": "Mr.",
    "stateOrProvince": "IL",
    "street1": "100 Main St.",
    "street2": ""
  },
  "technical": {
    "city": "Chicago",
    "company": "TestCo, Inc.",
    "countryCode": "US",
    "email1": "test@test.com",
    "email2": "",
    "fax": "",
    "firstName": "John",
    "lastName": "Smith",
    "middleName": "",
    "phone1": "555-555-5501",
    "phone2": "",
    "postalCode": "60001",
    "salutation": "Mr.",
    "stateOrProvince": "IL",
    "street1": "100 Main St.",
    "street2": ""
  }
}
 
Response
204 No Content
See also