GET
/v1/resources/orders/{idorder}
¶Returns information about specified order.
Request Headers: | |
---|---|
|
|
Parameters: |
|
Query Parameters: | |
|
|
Response Headers: | |
|
|
Response JSON Object: | |
|
|
Status Codes: |
|
Request:
GET /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Accept: application/json
Host: ticketscloud.org
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
{
"customer": {},
"created_at": null,
"deal": "535fb1f1dca6a9d1638f2008",
"event": "5357baaff51600525c9e1397",
"id": "537e1d95f05f951cded9cb02",
"reserved_till": null,
"rules": {
"5360a75a2b590f1c88e8680c": "537368ff1b9bf9d05cca835a"
},
"vendor": null,
"status": "executed",
"tickets": [
"537df47b6ab04735203a7219",
"53b9421428422ec1b9cafbb5"
],
"updated_at": null,
"value": null
}
PATCH
/v1/resources/orders/{idorder}
¶Updates order data.
Request Headers: | |
---|---|
|
|
Parameters: |
|
Query Parameters: | |
|
|
Request JSON Object: | |
|
|
Response Headers: | |
|
|
Response JSON Object: | |
|
|
Status Codes: |
|
Request:
PATCH /v1/resources/orders/535fb19bdca6a9d1638f2007 HTTP/1.1
Accept: application/json
Content-Type: applcation/json
Host: ticketscloud.org
{
"tickets": [
"537df47b6ab04735203a7219",
"53b9421428422ec1b9cafbb5",
"734b22afa3d5283e7146734d7e97b158"
]
}
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
{
"customer": {},
"created_at": null,
"deal": "535fb1f1dca6a9d1638f2008",
"event": "5357baaff51600525c9e1397",
"id": "537e1d95f05f951cded9cb02",
"reserved_till": null,
"rules": {
"5360a75a2b590f1c88e8680c": "537368ff1b9bf9d05cca835a"
},
"vendor": null,
"status": "executed",
"tickets": [
"537df47b6ab04735203a7219",
"53b9421428422ec1b9cafbb5",
"734b22afa3d5283e7146734d7e97b158"
],
"updated_at": null,
"value": null
}
DELETE
/v1/resources/orders/{idorder}
¶
<header Accept: application/json >header Content-Type: application/json >header Transfer-Encoding: chunked
code 200: Ok code 400: Invalid request parameters code 401: Authentication required code 403: Operation not allowed Request:
DELETE /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1 Accept: application/json Host: ticketscloud.orgResponse:
HTTP/1.1 200 OK Connection: keep-alive Content-Length: 2 Content-Type: application/json; charset=UTF-8 Server: nginx {}
GET
/v1/resources/orders
¶Request Headers: | |
---|---|
|
|
Query Parameters: | |
|
|
Response Headers: | |
|
|
Response JSON Array of Objects: | |
|
|
Response JSON Object: | |
|
|
Status Codes: |
|
Request:
GET /v1/resources/orders HTTP/1.1
Accept: application/json
Authorization: key my-very-secret-key
Host: ticketscloud.org
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
[
{
"customer": {},
"created_at": "2014-07-16T21:00:00+00:00",
"deal": "535fb1f1dca6a9d1638f2008",
"event": "5357baaff51600525c9e1397",
"id": "537e1d95f05f951cded9cb02",
"reserved_till": "2015-07-16T21:00:00+00:00",
"rules": {
"5360a75a2b590f1c88e8680c": "537368ff1b9bf9d05cca835a"
},
"vendor": null,
"status": "executed",
"tickets": [
"53b9421428422ec1b9cafbb5",
"537df47b6ab04735203a7219"
],
"updated_at": "2014-07-16T21:00:00+00:00",
"value": null
},
{
"customer": {
"email": null,
"first_name": null,
"last_name": null,
"user": null
},
"created_at": "2014-07-16T21:00:00+00:00",
"deal": "535fb1f1dca6a9d1638f2008",
"event": "5357baaff51600525c9e1397",
"id": "5360a81f2b590f1c88e8680f",
"reserved_till": null,
"rules": {
"5360a75a2b590f1c88e8680c": "537368ff1b9bf9d05cca835a"
},
"vendor": null,
"status": "done",
"tickets": [
"5360a7fc2b590f1c88e8680e"
],
"updated_at": "2014-07-16T21:00:00+00:00",
"value": null
}
]
+----------+ +-------------+ +------+ +----------+
| executed | --> | in_progress | --> | done | --> | refunded |
+----------+ +-------------+ +------+ +----------+
| |
| |
v |
+----------+ |
| canceled | <-----+
+----------+
On order creation, you must specify the ticket IDs which customer wanted to buy:
POST /v1/resources/orders HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"tickets": ["ticket-id1", "ticket-id2"],
"event": "event-id"
}
However, for some events there are no tickets which may have some specific serial number or ID, or you don’t even care about. In this cause you can order just some “random” tickets without explicitly specifying their IDs:
POST /v1/resources/orders HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"random": {
"ticketset-id": 13,
}
"event": "event-id"
}
The Deal ID is optional and only need when you have to explicitly define the related deal which will be used for price calculation.
When order becomes created, it receives status executed.
When order is created, the only information that could be updated is the ordered tickets:
PATCH /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"tickets": ["id2", "id3"]
}
PATCH /v1/resources/orders/{idorder} HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"random": {
"ticketset-id": 13,
"other-ticketset-id": 1,
}
}
You must to always pass full set of tickets that have to be in the order, even if you want to add the single one onto it. If some tickets were ordered, but becomes missed on update their reservation gets removed.
When order is done and it’s time to pay the money for it, it must be updated to set status as in_progress:
PATCH /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"status": "in_progress"
}
When order had been paid, it must be updated to set status as done:
PATCH /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"status": "done"
}
However, sometime you’ll have to cancel the order. This could be done with easy by order deletion:
DELETE /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
This operation is equivalent to manually status update to canceled:
PATCH /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"status": "canceled"
}
PATCH /v1/resources/orders/537e1d95f05f951cded9cb02 HTTP/1.1
Authorization: key my-very-secret-key
Content-Type: application/json
{
"customer": {
"first_name": "John",
"last_name": "Smith",
"email": "user@mail.us",
}
}