Skip to main content

Quick start

Sell a free-visit test ticket in six requests: login, catalog, card, order, order item, confirmation.

Requirements​

  • An agent account in the test environment: email and password — how to get one
  • The test environment base URL: https://dev-api.globalticket.uz/esbo

Step 1: Get an access token​

curl -X POST https://dev-api.globalticket.uz/esbo/api/v1/public/agent/login \
-H "Content-Type: application/json" \
-d '{"email": "agent@example.com", "password": "<password>"}'

Response:

{
"accessToken": "eyJhbGciOi...",
"refreshToken": "eyJhbGciOi...",
"expiresIn": 3600
}

Store the accessToken — you need it in all following requests in the Authorization: Bearer <accessToken> header.

Step 2: Find a card in the catalog​

curl "https://dev-api.globalticket.uz/esbo/api/v1/private/agent/catalog?page=1&limit=20" \
-H "Authorization: Bearer <accessToken>" \
-H "Accept-Language: en"

Pick a card with saleType: FREE_VISIT — a free visit without a session. Note its id.

Step 3: Get the card version and tariffs​

curl https://dev-api.globalticket.uz/esbo/api/v1/private/agent/sales-cards/12 \
-H "Authorization: Bearer <accessToken>"

From the response you need:

  • versionId — the card version; the order is created with it
  • the id of a tariffs tree leaf with a filled price — it is passed as rowId

Step 4: Create an order​

curl -X POST https://dev-api.globalticket.uz/esbo/api/v1/private/agent/orders \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{"salesCardId": 12, "versionId": 120}'

Response 201: an order in the DRAFT status with an id and an expiresAt deadline. The order is valid for 15 minutes from creation.

Step 5: Add tickets and check the amount​

curl -X POST https://dev-api.globalticket.uz/esbo/api/v1/private/agent/orders/1234/items \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{"itemType": "TARIFF", "rowId": 5, "quantity": 2}'
curl -X POST https://dev-api.globalticket.uz/esbo/api/v1/private/agent/orders/1234/validate \
-H "Authorization: Bearer <accessToken>"

Charge the finalAmount from the validate response.

Step 6: Confirm the payment and get the tickets​

After a successful payment on your side:

curl -X POST https://dev-api.globalticket.uz/esbo/api/v1/private/agent/orders/1234/confirm \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7" \
-d '{"ticketLanguage": "EN", "group": false}'

The 200 response contains the order in the PAID status and the tickets. Generate a QR code from the qrToken of each ticket and deliver it to the buyer.

Next steps​