Orders:POST
From Hostway API Documentation
Revision as of 16:59, 15 February 2013 by Mike.robski (Talk | contribs)
POST /orders
Creates a new order and returns the unique order URI.
Contents |
Request
POST /orders
URI Parameters
None.
Request Headers
- Content-Type
- Required. Set this header to
application/json; charset=UTF-8
- Cookie
- Optional. A cookie named OwnerId may be specified 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 a previous request for this resource (in the Set-Cookie response header).
Request Body
{}
Response
Status Code
- 201 Created
- The new order was created.
- 409 Conflict
- The client already has an open order. If the OwnerId cookie was passed in the request headers, a 409 will be returned if there's already an open (unsubmitted) order for the same client.
Response Headers
- Location
- Returned with successful response. Contains the order URI. The client must use this URI for all subsequent operations with the order.
- Set-Cookie
- Returned with successful response. Contains an OwnerId value which must be submitted with all subsequent requests for this order. The OwnerId identifies the client and prohibits it from having more than one open (unsubmitted) orders.
Response Body
{ "orderId": "{orderId}", "links": [ {"href": "https://api.hostway.com/orders/", "rel": "self"}, {"href": "https://api.hostway.com/orders/{orderId}", "rel": "item"} ] }
Parameters
- orderId - string
- The Id of the new order
- links - list
- Hypermedia for this resource. Links to self and the newly created order.
Example
Request
POST /orders Content-Type: application/json; charset=UTF-8 {}
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/0000013ad6dd95746a399f90000a71384bf242cf Set-Cookie : OwnerId=b0d6352a-f66a-476d-8e1d-2f3f9dea5c49; Path=/ { "orderId": "0000013ad6dd95746a399f90000a71384bf242cf", "links": [ {"href": "https://api.hostway.com/orders/", "rel": "self"}, {"href": "https://api.hostway.com/orders/0000013ad6dd95746a399f90000a71384bf242cf", "rel": "item"} ] }
See also