API - POBIERANIE ZAMÓWIEŃ

M
Written by Michal
Updated 11 months ago

Zastosowanie

Endpoint /order służy do:

  1. pobierania kolekcji zamówień
  2. pobierania szczegółów zamówienia

Specyfikacja GET - kolekcja zamówień

Request

HTTP GET https://drinks2cash.com/api/orderAuthorization: <api_key_dystrybutora> W query string można podać filtry:

  1. from - aby zwrócić zamówienia z datą utworzenia większą lub równą wartości "from"
  2. to - aby zwrócić zamówienia z datą utworzenia mniejszą lub równą wartości "to"
  3. limit - ilość zamówień na stronie
  4. offset - strona, liczona od 0

Przykładowe zapytanie: https:/drinks2cash.com/api/order?limit=2&offset=0&from=2022-09-24&to=2023-09-25 Swój api_key znajdziesz na stronie: https://drinks2cash.com/order/admin-importer

Responses

HTTP 200 - OK Body (json):

{
    "code": 200,
    "reasonPhrase": "OK",
    "data": [
        {
            "order_number": 64501123,
            "create_time": "2022-09-26 10:11:43",
            "status": "IN_REALIZATION",
            "client_confirmation_status": "CONFIRMED",
            "client_confirmation_time": "2022-09-26 10:12:38",
            "payment_type": "PREPAYMENT",
            "currency": "PLN",
            "client_phone": "81121592832",
            "client_email": "xxx@gmail.com",
            "delivery_cost": "25.00",
            "delivery_firstname": "xxx",
            "delivery_lastname": "xxx",
            "delivery_company_name": "KOWALSKI SC.",
            "delivery_zip": "87-100",
            "delivery_city": "TORUŃ",
            "delivery_country": "PL",
            "delivery_street": "ul. xxx 7 m. 1",
            "delivery_number": "123456789",
            "delivery_tracking_number": "123,
            "invoice_company_name": "KOWALSKI SC.",
            "invoice_zip": "87-100",
            "invoice_city": "TORUŃ",
            "invoice_country": "PL",
            "invoice_street": "ul. xxx 7 m. 16",
            "invoice_number": "123456789",
            "invoice_tax_number": "9999999999",
            "products": [
                {
                    "product_sku": "5902573009129",
                    "product_ean": "5902573009129",
                    "product_d2c_offer_id": 338453,
                    "product_name": "Wódka Żubr Cytrynowy 25% 200 ml",
                    "product_quantity": "100.00",
                    "product_quantity_in_pack": 1,
                    "product_price_net": "5.81",
                    "product_vat_rate": 23,
                    "product_unit": "PIECE",
                    "product_value_net": "581.00"
                }
            ]
        },
        {
            "order_number": 64501123,
            "create_time": "2023-01-13 14:19:43",
            "status": "IN_REALIZATION",
            "client_confirmation_status": "CONFIRMED",
            "client_confirmation_time": "2023-01-27 09:53:24",
            "payment_type": "PREPAYMENT",
            "currency": "PLN",
            "client_phone": "886159282",
            "client_email": "yyy@gmail.com",
            "delivery_cost": "0.00",
            "delivery_firstname": "yyy",
            "delivery_lastname": "yyy",
            "delivery_company_name": "yyy sp. z o.o.",
            "delivery_zip": "87-105",
            "delivery_city": "Toruń",
            "delivery_country": "PL",
            "delivery_street": "yyy",
            "delivery_number": "118",
            "delivery_tracking_number": null,
            "invoice_company_name": "yyy sp. z o.o.",
            "invoice_zip": "87-105",
            "invoice_city": "Toruń",
            "invoice_country": "PL",
            "invoice_street": "yyy",
            "invoice_number": "118",
            "invoice_tax_number": "0000000000",
            "products": [
                {
                    "product_sku": "5902573009129",
                    "product_ean": "5902573009129",
                    "product_d2c_offer_id": 333428,
                    "product_name": "Wódka Żubr Cytrynowy 25% 200 ml",
                    "product_quantity": "100.00",
                    "product_quantity_in_pack": 1,
                    "product_price_net": "5.81",
                    "product_vat_rate": 23,
                    "product_unit": "PIECE",
                    "product_value_net": "581.00"
                },
                {
                    "product_sku": "0420041",
                    "product_ean": "5099873089798",
                    "product_d2c_offer_id": 352341,
                    "product_name": "Whisky Jack Daniel's 40% 700 ml",
                    "product_quantity": "1.00",
                    "product_quantity_in_pack": 1,
                    "product_price_net": "52.11",
                    "product_vat_rate": 23,
                    "product_unit": "PIECE",
                    "product_value_net": "52.11"
                }
            ]
        }
    ]
}

HTTP 403 - Forbidden Body:

{
    "code": 403,
    "reasonPhrase": "Forbidden",
    "data": "Unauthorised"
}

Nie zidentyfikowano użytkownika. Sprawdź, czy podałeś poprawne api_key, znajdziesz je w swoim panelu administracyjnym w zakładce https://drinks2cash.com/order/admin-importer HTTP 400 - Bad requestBłędne parametry żądania. Body:

{
    "code": 400,
    "reasonPhrase": "Bad Request",
    "message": {
        "from": {
            "dateInvalidDate": "Podana wartość nie jest poprawną datą"
        },
        "offset": {
            "notDigits": "Podana wartość może zawierać tylko cyfry"
        },
        "limit": {
            "notDigits": "Podana wartość może zawierać tylko cyfry"
        }
    }
}

Specyfikacja GET /{id} - pojedyncze zamówienie

Request

HTTP GET https://drinks2cash.com/api/order/ {id} Authorization: <api_key_dystrybutora> Id to numer zamówienia. Przykładowe zapytanie: https://drinks2cash.com/api/order/6443622 Zwraca konkretne zamówienie o numerze id.

Responses

HTTP 200 - OK Body (json):

{
    "code": 200,
    "reasonPhrase": "OK",
    "data": [
        {
            "order_number": 6443622,
            "create_time": "2022-09-26 10:11:43",
            "status": "IN_REALIZATION",
            "client_confirmation_status": "CONFIRMED",
            "client_confirmation_time": "2022-09-26 10:12:38",
            "payment_type": "PREPAYMENT",
            "currency": "PLN",
            "client_phone": "81121592832",
            "client_email": "xxx@gmail.com",
            "delivery_cost": "25.00",
            "delivery_firstname": "xxx",
            "delivery_lastname": "xxx",
            "delivery_company_name": "KOWALSKI SC.",
            "delivery_zip": "87-100",
            "delivery_city": "TORUŃ",
            "delivery_country": "PL",
            "delivery_street": "ul. xxx 7 m. 1",
            "delivery_number": "123456789",
            "delivery_tracking_number": "123,
            "invoice_company_name": "KOWALSKI SC.",
            "invoice_zip": "87-100",
            "invoice_city": "TORUŃ",
            "invoice_country": "PL",
            "invoice_street": "ul. xxx 7 m. 16",
            "invoice_number": "123456789",
            "invoice_tax_number": "9999999999",
            "products": [
                {
                    "product_sku": "5902573009129",
                    "product_ean": "5902573009129",
                    "product_d2c_offer_id": 338453,
                    "product_name": "Wódka Żubr Cytrynowy 25% 200 ml",
                    "product_quantity": "100.00",
                    "product_quantity_in_pack": 1,
                    "product_price_net": "5.81",
                    "product_vat_rate": 23,
                    "product_unit": "PIECE",
                    "product_value_net": "581.00"
                }
            ]
        }
    ]
}

HTTP 403 - Forbidden Body:

{
    "code": 403,
    "reasonPhrase": "Forbidden",
    "data": "Unauthorised"
}

Nie zidentyfikowano użytkownika. Sprawdź, czy podałeś poprawne api_key, znajdziesz je w swoim panelu administracyjnym w zakładce https://drinks2cash.com/order/admin-importer HTTP 400 - Bad request Błędne parametry żądania. Body:

{
    "code": 400,
    "reasonPhrase": "Bad Request",
    "message": {
        "id": {
            "notDigits": "Podana wartość może zawierać tylko cyfry"
        }
    }
}
Did this answer your question?