Orders-orderId-account-attributes:PUT
From Hostway API Documentation
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 99) |
Latest revision as of 09:06, 14 October 2014
PUT /orders/{orderId}/account/attributes
Set the list of attributes for an account in a given order.
Request
PUT /orders/{orderId}/account/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:
- partner_account_id - unique account identifier in the partner system. The value should be unique within the franchise.
- attributeValue - string
- The value of the attribute max 200 characters. Should adhere to the rules for the attribute specified by the name.
- The value of the "partner_account_id" attribute is max 100 characters. Allowed characters are alphanumeric characters, underscore, dot and dash.
Response
Status Code
Status Code | Error Message | Description |
---|---|---|
204 No Content | - | The account attributes were successfully set. |
400 Bad Request | POST data error | The request body format is invalid and all attributes must have less than 200 characters. |
Not allowed or not existing MetaData Type | Setting some bad account attributes | |
Partner Account ID cannot exceed 100 characters | - | |
401 Unauthorized | - | No owner Id specified or the specified owner is not authorized to add attributes for this account. |
403 Forbidden | Unauthorized: Attributes failed permission check | Access order account attributes as an authenticated user, not associated with the order. |
404 Not Found | Resource not found | The specified order does not exist. |
409 Conflict | Account ID already in use | Attribute value for Partner Account ID, supposed to be unique, is already in use. |
500 Internal Server Error | - | Account has not been set for this order. |
502 Bad Gateway | - | A critical (unknown) error occurred. |
Response Body
None.
Example
Set valid account attribute
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"partner_account_id", "value":"paccid_050914054136" } ]
Response
204 No Content
Set bad account attributes
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"attribute_a", "value":"value_a" }, { "name":"attribute_b", "value":"value_b" } ]
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "computeFault": { "guid": "5268a14c-ced6-4f32-87ee-aa6709414396", "message": "Not allowed or not existing MetaData Type", "code": 400, "details": "" } }
Set an attribute with too long value
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"partner_account_id", "value":"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" } ]
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "computeFault": { "guid": "6c0ab111-f5b0-4730-a3fd-0076633b5dee", "message": "POST data error", "code": 400, "details": "" } }
Set too long Partner Account ID value
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"partner_account_id", "value":"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" } ]
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "computeFault": { "guid": "fbad4ff5-120c-4d1e-b2b3-1309937424d7", "message": "Partner Account ID cannot exceed 100 characters", "code": 400, "details": "" } }
Set attributes with wrong OwnerId
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={wrong_order_id}; Path=/ [ { "name":"partner_account_id", "value":"paccid_050914054136" } ]
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}/account/attributes Authorization: {unassociated_user_authorization} [ { "name":"partner_account_id", "value":"paccid_050914054136" } ]
Response
403 Forbidden Content-Type: application/json; charset=UTF-8 { "forbidden" : { "guid" : "66f63a81-52e9-4ec6-a50a-42acebc021e7", "message" : "Unauthorized: Attributes failed permission check", "code" : 403, "details" : "" } }
Set existing Partner Account ID
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"partner_account_id", "value":"ext_140213131348" } ]
Response
409 Conflict Content-Type : application/json; charset=UTF-8 { "conflict": { "guid": "a8d38abe-1f68-49c5-bafe-29894671ed06", "message": "Account ID already in use", "code": 409, "details": "" } }
Account has not been set
Request
PUT /orders/{orderId}/account/attributes Cookie: OwnerId={owner_id}; Path=/ [ { "name":"partner_account_id", "value":"paccid_050914054136" } ]
Response
500 Internal Server Error Content-Type : application/json; charset=UTF-8 { "computeFault" : { "guid" : "a4eae57d-b172-45ff-ae6e-474a8b6061a0", "timestamp" : "2014-09-10 10:12:41", "code" : 500, "errorRefId" : "a4eae57d-b172-45ff-ae6e-474a8b6061a0" } }
See also