Orders-orderId-attributes:PUT

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 98)
m (1 revision: Release 99)
 
(One intermediate revision by one user not shown)
Line 56: Line 56:
 
| The request body format is invalid.  
 
| The request body format is invalid.  
 
|-
 
|-
| Code: unknown_metadata_type, Could not find MetaData Type {attribute_key} for franchise {franchise}.
+
| 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).
 
| The attribute name is not supported by the franchise, the attribute value is invalid (e.g: too long, contains invalid characters, etc).
 
|-
 
|-
 
| 401 Unauthorized
 
| 401 Unauthorized
 
| align="center" | -
 
| align="center" | -
| Set order metadata without authenticating.
+
| 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
 
| 404 Not Found
Line 75: Line 79:
  
 
=== Set order attributes correctly ===
 
=== Set order attributes correctly ===
 
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>
Line 88: Line 91:
  
 
=== Set order attributes with invalid key ===
 
=== Set order attributes with invalid key ===
 
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>
Line 104: Line 106:
 
   "computeFault": {
 
   "computeFault": {
 
     "guid": "5b01960d-4110-43f0-b58f-d3178db61c6d",
 
     "guid": "5b01960d-4110-43f0-b58f-d3178db61c6d",
     "message": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: unknown_metadata_type,
+
     "message": "Could not find MetaData Type nonexistent_key for franchise hostway_us_main",
Could not find MetaData Type nonexistent_key for franchise hostway_us_main",
+
 
     "code": 400, "details": ""
 
     "code": 400, "details": ""
 
   }
 
   }
Line 111: Line 112:
  
 
=== Set order attributes with malformed body ===
 
=== Set order attributes with malformed body ===
 
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>
Line 137: Line 137:
  
 
=== Set order attributes without authenticating ===
 
=== Set order attributes without authenticating ===
 
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>
Line 156: Line 155:
 
does not understand how to supply the credentials required.</nowiki>
 
does not understand how to supply the credentials required.</nowiki>
  
=== Set order attributes of unexisting order ===
+
=== 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'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>

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