Orders-orderId-account-contactInfo-contactType:PUT

From Hostway API Documentation
Jump to: navigation, search

PUT /orders/{orderId}/account/contactInfo/{contactType}

Set the account contact details for a given contact type in an order.

Contents


Request

PUT /orders/{orderId}/account/contactInfo/{contactType}

Request Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.
contact_type - string
Contact Type (regular, billing, administrator or technical)

URI Parameters

None.

Request Headers

Content-Type
Required. Set this header to application/json; charset=UTF-8
Cookie
A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.

Request Body

{
  "name": {
   "salutation": "{salutation}",
   "firstName": "{firstname}",
   "middleName": "{middleName}",
   "lastName": "{lastName}",
   "company": "{company}"
  },
  "address": {
   "street1": "{street1}",
   "street2": "{street2}",
   "city": "{city}",
   "stateOrProvince": "{stateOrProvince}",
   "postalCode": "{postalCode}",
   "countryCode": "{countryCode}"
  },
  "contactMedia": {
   "phone1": "{phone1}",
   "phone2": "{phone2}",
   "fax": "{fax}",
   "email1": "{email1}",
   "email1Format": "{html|text}",
   "email2": "{email2}",
   "email2Format": "{html|text}"
  }
}
 

Parameters

salutation - string
(OPTIONAL)
May contain one of the salutations provided by GET /salutations
firstName - string
Required string max 50 characters. May contain only alphanumerics, white space and the following characters: -.'
middleName - string
Optional string max 50 characters. May contain only alphanumerics, white space and the following characters: -.'
lastName - string
Required string max 50 characters. May contain only alphanumerics, white space and the following characters: -.'
company - string
Optional string max 200 characters. May contain only alphanumerics, white space and the following characters: -.'
street1 - string
Required string max 100 characters. May contain only alphanumerics, white space and the following characters: -.'
street2 - string
Optional string max 100 characters. May contain only alphanumerics, white space and the following characters: -.'
city - string
Required string max 50 characters. May contain only alphanumerics, white space and the following characters: -.'
stateOrProvince - string
Required string max 20 characters. May contain only alphanumerics, white space and the following characters: -.' If the selected country is United States, then this must be a valid two-letter US state abbreviation. If the selected country is Canada, then this value must be a valid two-letter Canadian province abbreviation.
postalCode - string
Required string max 30 characters. May contain only alphanumerics, white space and the following characters: -.' If the selected country is United States, then the postalCode must be in format "#####" or "#####-####" (where "#" represents any numeric digit). If the selected country is Canada, then the 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).
country - string
Required string ISO 3166-1 alpha-2[1] country code.
phone1 - string
Required string ITU-T E.164[2] formatted phone number max 20 digits.
phone2 - string
Optional string ITU-T E.164[3] formatted phone number max 20 digits.
fax - string
Optional string ITU-T E.164[4] formatted phone number max 20 digits.
email1 - string
Required string valid e-mail address max 100 characters.
email1Format - string
Optional string – one of html or text. The default value of html will be applied if omitted from the request.
email2 - string
Optional string valid e-mail address max 100 characters.
email2Format - string
Optional string – one of html or text. The default value of html will be used if email2 is supplied and email2Format is omitted.

Response

Status Code

Status Code Error Message Description
204 No Content - The operation was successfully completed.
400 Bad Request POST data error The value of one or more contact info fields is not valid or missing.
Field cannot have any alphabet letters; only numbers and symbols allowed.
401 Unauthorized - No owner Id specified or the specified owner is not authorized to set contact info info for this order.
403 Forbidden Unauthorized: ContactInfo failed permission check Set account contact info as an authenticated user, not associated with the order.
404 Not Found Resource not found The specified order does not exist.
502 Bad Gateway - Account has not been set. Cannot add contact info.

Response Body

None.

Example

Set bad contact info values

Request

PUT /orders/{orderId}/account/contactInfo/billing
Cookie: OwnerId={owner_id}; Path=/

{ 
  "name": {
    "firstName": "&",
    "middleName": "&",
    "lastName": "&",
    "company": "Hostway",
    "salutation": "invalid"
  },
  "address": {
    "street1": "(",
    "street2": "(",
    "city": "&",
    "stateOrProvince": "&",
    "postalCode": "asfagag",
    "countryCode": "^"
  },
  "contactMedia": {
    "phone1": "a",
    "phone2": "a",
    "fax": "a",
    "email1": "em",
    "email1Format": "test"
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "1c9b2dc5-2feb-4599-9753-aae2c39853dd",
    "message": "POST data error",
    "code": 400,
    "details": {
      "name.lastName": "Only alphanumerics, spaces, and the following characters are allowed in lastName: -'.",
      "address.city": "Only alphanumerics, spaces, and the following characters are allowed in city: -'.",
      "address.street2": "Only alphanumerics, spaces, and the following characters are allowed in street2: -'.",
      "name.firstName": "Only alphanumerics, spaces, and the following characters are allowed in firstName: -'.",
      "address.street1": "Only alphanumerics, spaces, and the following characters are allowed in street1: -'.",
      "name.salutation": "\"invalid\" is not one of Mr., Ms., Mrs., Dr.",
      "address.stateOrProvince": "Only alphanumerics, spaces, and the following characters are allowed in stateOrProvince: -'.",
      "name.middleName": "Only alphanumerics, spaces, and the following characters are allowed in middleName: -'.",
      "contactMedia.email1": "Invalid email address in email1: em",
      "address.countryCode": "Invalid Country Code",
      "contactMedia.email1Format": "\"test\" is not one of html, text"
    }
  }
}

Set bad contact info values 2

Request

PUT /orders/{orderId}/account/contactInfo/billing
Cookie: OwnerId={owner_id}; Path=/

{
  "name": {
    "firstName": "Billing",
    "middleName": "X",
    "lastName": "Customer",
    "company": "Hostway" 
  },
  "address": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  },
    "contactMedia": {
    "phone1": "test",
    "phone2": "test",
    "fax": "test",
    "email1": "petre.popescu@hostway.com",
    "email1Format": "html",
    "email2": "gah@wev.com",
    "email2Format": "text"
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "computeFault": {
    "guid": "3fb07aa5-157e-474d-b7cc-ece0cf87f36e",
    "message": "Field cannot have any alphabet letters; only numbers and symbols allowed.",
    "code": 400,
    "details": ""
  }
}

Set contact info with wrong OwnerId

Request

PUT /orders/{orderId}/account/contactInfo/billing
Cookie: OwnerId={wrong_order_id}; Path=/

{
  "name": {
    "firstName": "Billing",
    "middleName": "X",
    "lastName": "Customer",
    "company": "Hostway",
    "salutation": "Mr."
  },
  "address": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  },
  "contactMedia": {
    "phone1": "312-555-2222",
    "phone2": "312-555-3333",
    "fax": "312-555-1111",
    "email1": "petre.popescu@hostway.com",
    "email1Format": "html",
    "email2": "gah@wev.com",
    "email2Format": "text"
  }
}

Response

401 Unauthorized
Content-Type: text/plain; charset=UTF-8

401 Unauthorized

This server could not verify that you are authorized to access the document you requested. 
Either you supplied the wrong credentials (e.g., bad password), 
or your browser does not understand how to supply the credentials required.

Unassociated user without cookie

Request

PUT /orders/{orderId}/account/contactInfo/billing
Authorization: {unassociated_user_authorization}

{
  "name": {
    "firstName": "Billing",
    "middleName": "X",
    "lastName": "Customer",
    "company": "Hostway",
    "salutation": "Mr."
  },
  "address": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  },
  "contactMedia": {
    "phone1": "312-555-2222",
    "phone2": "312-555-3333",
    "fax": "312-555-1111",
    "email1": "petre.popescu@hostway.com",
    "email1Format": "html",
    "email2": "gah@wev.com",
    "email2Format": "text"
  }
}

Response

403 Forbidden
Content-Type: application/json; charset=UTF-8

{
  "forbidden" : {
    "guid" : "53fd5c41-a4b1-48d1-8196-43fc5ba32cf2",
    "message" : "Unauthorized: ContactInfo failed permission check",
    "code" : 403,
    "details" : ""
  }
}

Set contact info in non-existent order

Request

PUT /orders/{non-existent_orderId}/account/contactInfo/billing
Cookie: OwnerId={owner_id}; Path=/

{
  "name": {
    "firstName": "Billing",
    "middleName": "X",
    "lastName": "Customer",
    "company": "Hostway",
    "salutation": "Mr."
  },
  "address": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  },
  "contactMedia": {
    "phone1": "312-555-2222",
    "phone2": "312-555-3333",
    "fax": "312-555-1111",
    "email1": "petre.popescu@hostway.com",
    "email1Format": "html",
    "email2": "gah@wev.com",
    "email2Format": "text"
  }
}

Response

404 Not Found
Content-Type : application/json; charset=UTF-8

{
  "itemNotFound" : {
    "guid" : "ed5f236d-6983-4576-b1d3-9cd69c4255a0",
    "message" : "Resource not found",
    "code" : 404,
    "details" : ""
  }
}

Set contact info on an unset account

Request

PUT /orders/{orderId}/account/contactInfo/billing
Cookie: OwnerId={owner_id}; Path=/

{
  "name": {
    "firstName": "Billing",
    "middleName": "X",
    "lastName": "Customer",
    "company": "Hostway",
    "salutation": "Mr."
  },
  "address": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  },
  "contactMedia": {
    "phone1": "312-555-2222",
    "phone2": "312-555-3333",
    "fax": "312-555-1111",
    "email1": "petre.popescu@hostway.com",
    "email1Format": "html",
    "email2": "gah@wev.com",
    "email2Format": "text"
  }
}

Response

502 Bad Gateway
Content-Type : application/json; charset=UTF-8

{
  "computeFault" : {
    "guid" : "5db3e3c9-37ac-4a1d-8085-c931577e1c16",
    "timestamp" : "2014-09-10 12:10:12",
    "code" : 502,
    "errorRefId" : "5db3e3c9-37ac-4a1d-8085-c931577e1c16"
  }
}

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox