Orders-orderId-attributes:PUT
From Hostway API Documentation
Revision as of 09:07, 14 October 2014 by Mike.robski (Talk | contribs)
PUT /orders/{orderId}/attributes
Set the list of attributes for an order.
Contents |
Request
PUT /orders/{orderId}/attributes
Request Parameters
- orderId - string
- The unique order Id. The URI of the order is returned by the POST /orders call.
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": "{attributeName}", "value": "{attributeValue}" }, { "name": "{attributeName}", "value": "{attributeValue}" } ]
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.
Response
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. |
Example
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
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": "" } }
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" } } }
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.
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": "" } }
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": "" } }
See also