Orders

Order

GET /v1/resources/orders/{idorder}

Returns information about specified order.

Request Headers:
 
Parameters:
  • idorder (string) – Order ID
Query Parameters:
 
Response Headers:
 
Response JSON Object:
 
  • customer (object) – Customer information
  • created_at (datetime) – Partner creation timestamp
  • deal (string) – Deal ID
  • event (string) – Event ID
  • id (string) – Order ID
  • reserved_till (datetime) – Related Legal
  • rules (object) – Rules mapping
  • vendor (string) – vendor ID
  • status (string) – Order status
  • tickets (array) – List of ordered tickets ids
  • promocodes (array) – List of promocode as objects
  • updated_at (datetime) – Partner update timestamp
  • value – Value
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:
  • idorder (string) – Order ID
Query Parameters:
 
Request JSON Object:
 
  • customer (object) – Customer information
  • status (string) – Order status
  • tickets (array) – List of ordered tickets ids
  • all_or_nothing (bool) – reserve all tickets or not resetve nothing
  • promocodes (array) – List of promocode as strings (field code)
Response Headers:
 
Response JSON Object:
 
  • customer (object) – Customer information
  • created_at (datetime) – Partner creation timestamp
  • deal (string) – Deal ID
  • event (string) – Event ID
  • id (string) – Order ID
  • reserved_till (datetime) – Related Legal
  • rules (object) – Rules mapping
  • vendor (string) – vendor ID
  • status (string) – Order status
  • tickets (array) – List of ordered tickets ids
  • updated_at (datetime) – Partner update timestamp
  • promocodes (array) – List of promocode as objects
  • value – Value
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.org

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 2
Content-Type: application/json; charset=UTF-8
Server: nginx

{}

Orders

GET /v1/resources/orders
Request Headers:
 
Query Parameters:
 
Response Headers:
 
Response JSON Array of Objects:
 
  • customer (object) – Customer information
  • created_at (datetime) – Partner creation timestamp
  • deal (string) – Deal ID
  • event (string) – Event ID
  • id (string) – Order ID
  • reserved_till (datetime) – Related Legal
  • rules (object) – Rules mapping
  • status (string) – Order status
  • tickets (array) – List of ordered tickets ids
  • updated_at (datetime) – Partner update timestamp
  • value – Value
Response JSON Object:
 
  • vendor (string) – vendor ID
  • promocodes (array) – List of promocode as objects
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
    }
]

Order Lifecycle

+----------+     +-------------+     +------+     +----------+
| executed | --> | in_progress | --> | done | --> | refunded |
+----------+     +-------------+     +------+     +----------+
  |                |
  |                |
  v                |
+----------+       |
| canceled | <-----+
+----------+

Order Creation

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.

Order updating

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.

Order Commit

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"
}

Order Completion

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"
}

Order Cancellation

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"
}

Update Customer Information

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",
    }
}

Оглавление

Предыдущий раздел

Media Files

Следующий раздел

Partners

Эта страница