Orders-orderId-attributes:PUT

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with "= PUT /orders/''{orderId}''/attributes = Set the list of attributes for an order. __TOC__ == Request == <code>PUT /orders/''{orderId}''/attributes</code> ==== Request Parame...")
 
m (1 revision: Release 99)
 
(4 intermediate revisions by 2 users not shown)
Line 43: Line 43:
  
 
=== Status Code ===
 
=== Status Code ===
;204 No Content : The order attributes were successfully set.
+
{| class="wikitable"
 +
! Status Code
 +
! Error Message
 +
! Description
 +
|-
 +
| 204 No Content
 +
| align="center" | -
 +
| The order attributes were successfully set.
 +
|-
 +
| rowspan="2" | 400 Bad Request
 +
| POST data error
 +
| The request body format is invalid.
 +
|-
 +
| Could not find MetaData Type {attribute_key} for franchise {franchise}.
 +
| The attribute name is not supported by the franchise, the attribute value is invalid (e.g: too long, contains invalid characters, etc).
 +
|-
 +
| 401 Unauthorized
 +
| align="center" | -
 +
| No owner Id specified or the specified owner is not authorized to set order attributes.
 +
|-
 +
| 403 Forbidden
 +
| Unauthorized: Attributes failed permission check
 +
| Set order attributes as an authenticated user, not associated with the order.
 +
|-
 +
| 404 Not Found
 +
| Resource not found
 +
| The specified order does not exist.
 +
|-
 +
| 502 Bad Gateway
 +
| align="center" | -
 +
| A critical (unknown) error occurred.
 +
|}
  
;400 Bad Request : The request body format is invalid, the attribute name is not supported by the franchise, the attribute value is invalid (e.g: too long, contains invalid characters, etc).
+
== Example ==
  
;404 Not Found : The specified order does not exist.
+
=== Set order attributes correctly ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Cookie: OwnerId={owner_id}; Path=/
  
;502 Bad Gateway : A critical (unknown) error occurred.
+
[ {"name":"_utma", "value":"utma_val"}, {"name":"_utmb", "value":"utmb_val"} ]</nowiki>
  
=== Response Body ===
+
'''Response'''
None.
+
<nowiki>
 +
204 No Content</nowiki>
 +
 
 +
=== Set order attributes with invalid key ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 
 +
[ {"name":"nonexistent_key", "value":"some_value"} ]</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
400 Bad Request
 +
Content-Type : application/json; charset=UTF-8
 +
 
 +
{
 +
  "computeFault": {
 +
    "guid": "5b01960d-4110-43f0-b58f-d3178db61c6d",
 +
    "message": "Could not find MetaData Type nonexistent_key for franchise hostway_us_main",
 +
    "code": 400, "details": ""
 +
  }
 +
}</nowiki>
 +
 
 +
=== Set order attributes with malformed body ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 
 +
[ {"_utma": "utma_val"} ]</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
400 Bad Request
 +
Content-Type : application/json; charset=UTF-8
 +
 
 +
{
 +
  "badRequest": {
 +
    "guid": "9a6b18b4-66cf-4b5e-bee6-f4f44c0b9450",
 +
    "message": "POST data error",
 +
    "code": 400,
 +
    "details": {
 +
      "0.name": "Required",
 +
      "0.value": "Required"
 +
    }
 +
  }
 +
}</nowiki>
 +
 
 +
=== Set order attributes without authenticating ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 
 +
[ {"name":"nonexistent_key", "value":"some_value"} ]</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
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.</nowiki>
 +
 
 +
=== Unassociated user without cookie===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Authorization: {unassociated_user_authorization}
 +
 
 +
[ {"name":"_utma", "value":"utma_val"}, {"name":"_utmb", "value":"utmb_val"} ]</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
403 Forbidden
 +
Content-Type: application/json; charset=UTF-8
 +
 
 +
{
 +
  "forbidden": {
 +
    "guid": "4d1e97e2-1497-48d5-b7a3-b3726656c4b5",
 +
    "message": "Unauthorized: Attributes failed permission check",
 +
    "code": 403,
 +
    "details": ""
 +
  }
 +
}</nowiki>
 +
 
 +
=== Set order attributes of unexisting order ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/attributes
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 
 +
[ {"_utma": "utma_val"} ]</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
404 Not Found
 +
Content-Type : application/json; charset=UTF-8
 +
 
 +
{
 +
  "itemNotFound": {
 +
  "guid": "6273e2fb-6efd-4294-9281-7a1ea664cf11",
 +
  "message": "Resource not found",
 +
  "code": 404,
 +
  "details": ""
 +
  }
 +
}</nowiki>
  
 
== See also ==
 
== See also ==

Latest revision as of 09:07, 14 October 2014

[edit] PUT /orders/{orderId}/attributes

Set the list of attributes for an order.

Contents


[edit] Request

PUT /orders/{orderId}/attributes

[edit] Request Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.

[edit] URI Parameters

None.

[edit] 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.

[edit] Request Body

[
 {
  "name": "{attributeName}",
  "value": "{attributeValue}"
 },
 {
  "name": "{attributeName}",
  "value": "{attributeValue}"
 }
]
 

[edit] Parameters

attributeName - string
The unique name of the attribute. The list of supported attribute names is specific to the franchise. The common attributes include:
AffiliateId - identifies an affiliate.
attributeValue - string
The value of the attribute max 200 characters. Should adhere to the rules for the attribute specified by the name.

[edit] Response

[edit] Status Code

Status Code Error Message Description
204 No Content - The order attributes were successfully set.
400 Bad Request POST data error The request body format is invalid.
Could not find MetaData Type {attribute_key} for franchise {franchise}. The attribute name is not supported by the franchise, the attribute value is invalid (e.g: too long, contains invalid characters, etc).
401 Unauthorized - No owner Id specified or the specified owner is not authorized to set order attributes.
403 Forbidden Unauthorized: Attributes failed permission check Set order attributes as an authenticated user, not associated with the order.
404 Not Found Resource not found The specified order does not exist.
502 Bad Gateway - A critical (unknown) error occurred.

[edit] Example

[edit] Set order attributes correctly

Request

PUT /orders/{orderId}/attributes
Cookie: OwnerId={owner_id}; Path=/

[ {"name":"_utma", "value":"utma_val"}, {"name":"_utmb", "value":"utmb_val"} ]

Response

204 No Content

[edit] Set order attributes with invalid key

Request

PUT /orders/{orderId}/attributes
Cookie: OwnerId={owner_id}; Path=/

[ {"name":"nonexistent_key", "value":"some_value"} ]

Response

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

{
  "computeFault": {
    "guid": "5b01960d-4110-43f0-b58f-d3178db61c6d",
    "message": "Could not find MetaData Type nonexistent_key for franchise hostway_us_main",
    "code": 400, "details": ""
  }
}

[edit] Set order attributes with malformed body

Request

PUT /orders/{orderId}/attributes
Cookie: OwnerId={owner_id}; Path=/

[ {"_utma": "utma_val"} ]

Response

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

{
  "badRequest": {
    "guid": "9a6b18b4-66cf-4b5e-bee6-f4f44c0b9450",
    "message": "POST data error",
    "code": 400,
    "details": {
      "0.name": "Required",
      "0.value": "Required"
    }
  }
}

[edit] Set order attributes without authenticating

Request

PUT /orders/{orderId}/attributes
Cookie: OwnerId={owner_id}; Path=/

[ {"name":"nonexistent_key", "value":"some_value"} ]

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.

[edit] Unassociated user without cookie

Request

PUT /orders/{orderId}/attributes
Authorization: {unassociated_user_authorization}

[ {"name":"_utma", "value":"utma_val"}, {"name":"_utmb", "value":"utmb_val"} ]

Response

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

{
  "forbidden": {
    "guid": "4d1e97e2-1497-48d5-b7a3-b3726656c4b5",
    "message": "Unauthorized: Attributes failed permission check",
    "code": 403,
    "details": ""
  }
}

[edit] Set order attributes of unexisting order

Request

PUT /orders/{orderId}/attributes
Cookie: OwnerId={owner_id}; Path=/

[ {"_utma": "utma_val"} ]

Response

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

{
  "itemNotFound": {
  "guid": "6273e2fb-6efd-4294-9281-7a1ea664cf11",
  "message": "Resource not found",
  "code": 404,
  "details": ""
  }
}

[edit] See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox