Orders-orderId-account-contactInfo-contactType:PUT

(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 90)
Line 99: Line 99:
  
 
; email1Format - ''string''
 
; email1Format - ''string''
: Required string – one of ''html'' or ''text''.
+
: Optional string – one of ''html'' or ''text''. The default value of ''html'' will be applied if omitted from the request.
  
 
; email2 - ''string''
 
; email2 - ''string''
Line 105: Line 105:
  
 
; email2Format - ''string''
 
; email2Format - ''string''
: Optional string – one of ''html'' or ''text''.
+
: Optional string – one of ''html'' or ''text''. The default value of ''html'' will be used if ''email2'' is supplied and ''email2Format'' is omitted.
  
 
== Response ==
 
== Response ==
 
 
=== Status Code ===
 
=== Status Code ===
;204 No Content
+
{| class='wikitable'
: The operation was successfully completed.
+
|-
 
+
! Status Code
;400 Bad Request
+
! Error Message
: The request body contains invalid JSON or the values do not adhere to the restrictions set for them.
+
! Description
 
+
|-
;404 Not Found
+
| 204 No Content
: An account has not been added to the given order or the order does not exist.
+
| align="center" | -
 +
| The operation was successfully completed.
 +
|-
 +
| rowspan="2" | 400 Bad Request
 +
| POST data error
 +
| rowspan="2" | The value of one or more contact info fields is not valid or missing.
 +
|-
 +
| Code: contact_error, Field cannot have any alphabet letters; only numbers and symbols allowed.
 +
|-
 +
| 404 Not Found
 +
| Resource not found
 +
| The specified order does not exist.
 +
|-
 +
| 502 Bad Gateway
 +
| align="center" | -
 +
| Account has not been set. Cannot add contact info.
 +
|}
  
 
=== Response Body ===
 
=== Response Body ===
 
None.
 
None.
 +
 +
== Example ==
 +
=== Set bad contact info values ===
 +
'''Request'''
 +
<nowiki>
 +
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"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
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"
 +
    }
 +
  }
 +
}</nowiki>
 +
 +
=== Set bad contact info values 2 ===
 +
'''Request'''
 +
<nowiki>
 +
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"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
400 Bad Request
 +
Content-Type : application/json; charset=UTF-8
 +
 +
{
 +
  "computeFault": {
 +
    "guid": "3fb07aa5-157e-474d-b7cc-ece0cf87f36e",
 +
    "message": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: contact_error, Field cannot have any alphabet letters;
 +
only numbers and symbols allowed.",
 +
    "code": 400,
 +
    "details": ""
 +
  }
 +
}</nowiki>
 +
 +
=== Set contact info in non-existent order ===
 +
'''Request'''
 +
<nowiki>
 +
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"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
404 Not Found
 +
Content-Type : application/json; charset=UTF-8
 +
 +
{
 +
  "itemNotFound" : {
 +
    "guid" : "ed5f236d-6983-4576-b1d3-9cd69c4255a0",
 +
    "message" : "Resource not found",
 +
    "code" : 404,
 +
    "details" : ""
 +
  }
 +
}</nowiki>
 +
 +
=== Set contact info on an unset account ===
 +
'''Request'''
 +
<nowiki>
 +
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"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
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"
 +
  }
 +
}</nowiki>
  
 
== See also ==
 
== See also ==

Revision as of 07:19, 10 September 2014

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.
Code: contact_error, Field cannot have any alphabet letters; only numbers and symbols allowed.
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": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: contact_error, Field cannot have any alphabet letters;
 only numbers and symbols allowed.",
    "code": 400,
    "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