Orders-orderId-action:POST

From Hostway API Documentation
Revision as of 23:08, 18 November 2014 by Mike.robski (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

POST /orders/{orderId}/action

Performs an action like validating or submitting an order.

Contents

Request

POST /orders/{orderId}/action

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

{
  "action": "{action}",
  "actionData": {actionData}
  "quoteHash": {quoteId}
}
 

Parameters

action - string
The action that should be performed. Allowed values are:
validate - checks the integrity of the order.
submit - submits the order for processing.
actionData - dictionary
Optional. Reserved for data specific for the requested action.
quoteHash - string
Optional. Specifies the Id of the previously obtained quote to be used with the action.

Notes

If a sales agent authorization is provided, the submitted order will be assigned an agent.

Response

Status Code

Status Code Error Message Description
202 Accepted - The requested action was initiated successfully (in case of "submit" action). Check the status of the order for future updates.
204 No Content - The requested action was successfully completed (in case of "validate" action)
400 Bad Request Account has not been set Cannot check contact info because no account (new or existing) has been set in the order.
Cannot add test attribute because account has not been set.
No {attribute_name} attribute set. A required account attribute has not been set.
Contact info type {contact_type} is not set A required contact info type has not been set.
All plans in the order must contain at least one product. A product does not contain any service.
Missing plugin data for service type(s): set([u'core.www']) Service is missing attribute domain.
401 Unauthorized - No owner Id specified or the specified owner is not authorized to perform actions on this order.
403 Forbidden Unauthorized: Action failed permission check An unassociated user cannot validate or submit order.
404 Not Found Resource not found The specified order does not exist.
409 Conflict Domain-dependent services:
Cannot create domain alias to the same domain name. Duplicate domain.
Domain {domain_name} is associated with another account One of the domains to be ordered is already owned by another account
A domain in the order contains a restricted word One of the domains contains blacklisted word.
Contains a blacklisted domain One of the domains to be ordered is blacklisted.
Transfer is already in progress for this domain A transfer is in progress for a domain.
Email domain alias service: A domain alias would produce impossible to delivery loops
Domain {domain_name} has circular forwards to alias {alias_name} There is an email forwarder from the target domain name to a mailbox of the domain alias with the same username
There is an email forwarder from the domain alias to a mailbox of the target domain name with the same username
502 Bad Gateway - Unexpected backend response. Cannot submit or validate order.

Response Body

Depends on the result.

Error Response

{

 "{errorType}": {
   "message": "{errorMessage}",
   "code": {errorCode},
   "details": "{errorDetails}"
 }

}

Examples

Submit an order

Request

POST /orders/0000013ca61880fbfc068b33000a02c9d8ef861c/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/

{
  "action": "submit"
}

Response

202 Accepted
 

Validate an order

Request

POST /orders/0000013ca61880fbfc068b33000a02c9d8ef861c/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/

{
  "action": "validate"
}

Response

204 No Content

Submit an order with invalid quote

Request

POST /orders/0000013ca61880fbfc068b33000a02c9d8ef861c/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/

{
  "action" : "submit", 
  "quoteHash" : "invalid_quote_id"
}

Response

400 Bad Request

{
  "computeFault": {
    "message": "Account has not been set",
    "code": 400,
    "details": ""
  }
}

Order without contact info

Request

POST /orders/{orderId}/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId={ownerId}; Path=/

{
  "action" : "submit", 
  "quoteHash" : "{quoteId}"
}

Response

400 Bad Request

{
  "computeFault": {
    "guid": "32adf6a1-e710-4362-83c7-7743c7097db9",
    "message": "Contact info type \"regular\" is not set",
    "code": 400,
    "details": ""
  }
}

Submit an order before a service is added

Request

POST /orders/{orderId}/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId={ownerId}; Path=/

{
  "action" : "submit", 
  "quoteHash" : "{quoteId}"
}

Response

400 Bad Request

{
  "computeFault": {
    "guid": "7ef492af-3ebe-4334-9e37-5b0365977ef2",
    "message": "All plans in the order must contain at least one product.",
    "code": 400,
    "details": ""
  }
}

Order without domain attribute

Request

POST /orders/{orderId}/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId={ownerId}; Path=/

{
  "action" : "submit", 
  "quoteHash" : "{quoteId}"
}

Response

400 Bad Request

{
  "computeFault": {
    "guid": "bc2e3c0c-b4da-43e2-b576-7801180bfb6e",
    "message": "Missing plugin data for service type(s): set([u'core.www'])",
    "code": 400,
    "details": ""
  }
}

Unassociated user without cookie

Request

POST /orders/000001483b9336c4be0a0c89000a19010d347ea2/action
Authorization: {unassociated_user_authorization}
Content-Type: application/json; charset=UTF-8

{
  "action": "validate"
}

Response

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

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

Order containing a domain with blacklisted word

Request

POST /orders/{orderId}/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId={ownerId}; Path=/

{
  "action" : "submit", 
  "quoteHash" : "{quoteId}"
}

Response

409 Conflict

{
  "conflict": {
    "guid": "bfb2988f-d745-4b2a-9eff-f2deed3451db",
    "message": "A domain in the order contains a restricted word",
    "code": 409,
    "details": ""
  }
}

Domain associated with another account

Request

POST /orders/{orderId}/action
Content-Type:application/json; Charset=UTF-8
Cookie: OwnerId={ownerId}; Path=/

{
  "action" : "submit", 
  "quoteHash" : "{quoteId}"
}

Response

409 Conflict

{
  "conflict": {
    "guid": "3fcd11ec-ffb9-47be-b14e-53a74ecb7de2",
    "message": "Domain ng-test-hwus-petre-140718a.com is associated with another account",
    "code": 409,
    "details": ""
  }
}

OPTIONS /orders/{orderId}/action

In addition to the POST method the API supports the OPTIONS method for direct browser access to the API. The format of the request is:

OPTIONS /orders/{orderId}/action

Parameters

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

Request Headers

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.

Response Status Code

200 OK
Success
404 Not Found
The specified order does not exist.

Response Headers

Access-Control-Allow-Methods
A comma-separated list of request methods supported on this URI.
Access-Control-Allow-Origin
All origins are allowed. This header has value *.

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox