Orders-orderId-attributes:PUT
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 90) |
(→Status Code) |
||
Line 43: | Line 43: | ||
=== Status Code === | === Status Code === | ||
− | + | {| 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. | ||
+ | |- | ||
+ | | Code: unknown_metadata_type, 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" | - | ||
+ | | Set order metadata without authenticating. | ||
+ | |- | ||
+ | | 404 Not Found | ||
+ | | Resource not found | ||
+ | | The specified order does not exist. | ||
+ | |- | ||
+ | | 502 Bad Gateway | ||
+ | | align="center" | - | ||
+ | | A critical (unknown) error occurred. | ||
+ | |} | ||
− | + | == Example == | |
− | + | === Set order attributes correctly === | |
− | + | '''Request''' | |
+ | <nowiki> | ||
+ | PUT /orders/{orderId}/attributes | ||
+ | Cookie: OwnerId={owner_id}; Path=/ | ||
− | === Response | + | [ {"name":"_utma", "value":"utma_val"}, {"name":"_utmb", "value":"utmb_val"} ]</nowiki> |
− | + | ||
+ | '''Response''' | ||
+ | <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": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: unknown_metadata_type, | ||
+ | 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> | ||
+ | |||
+ | === 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 == |
Revision as of 02:33, 10 September 2014
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. |
Code: unknown_metadata_type, 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 | - | Set order metadata without authenticating. |
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": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: unknown_metadata_type, 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.
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