Partner API

General notes

Api is available at https://cloud.miniorders.com/partner-api/v1 under this conditions:

  • API always return JSON
  • content_type = application/json
  • authorization using HMAC
  • every right answer contains {“status”: “ok”}

Standard answers

Confirmation

{ “status”: “ok” } * always HTTP STATUS equals 200 * field status = “ok”

Error

{ “status”: “error”, “error”: “AccessDenied” } * error always has HTTP STATUS different than 200 (400,401,403,404,500) * it’s field status = “error” * error field can have additional parameter

Calculating a control sum of HMAC for GET and DELETE

X-hmac = hash_hmac(‘SHA1’ ,PUBLIC+REQUEST_PATH+HTTP_PARAMS, PRIVATE)

Calculating a control sum of HMAC for POST and PUT

X-hmac = hash_hmac(‘SHA1’, PUBLIC+REQUEST_PATH+HTTP_POST_JSON_BODY, PRIVATE)

API detail

Dictionary

Dictionary: Languages

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/language"
GET /partner-api/v1/language HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 1,
            "name": "English"
        },
        {
            "id": 2,
            "name": "Polski"
        },
        {
            "id": 13,
            "name": "Japan"
        }
    ]
}

Dictionary: Currency

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/currency"
GET /partner-api/v1/currency HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 1,
            "name": "USD",
            "short": "$",
            "direction": false
        },
        {
            "id": 2,
            "name": "PLN",
            "short": "zł",
            "direction": true
        },
        {
            "id": 3,
            "name": "EUR",
            "short": "€",
            "direction": false
        },
        {
            "id": 4,
            "name": "AED",
            "short": "د.إ",
            "direction": false
        },
        {
            "id": 5,
            "name": "RUB",
            "short": "₽",
            "direction": false
        },
        {
            "id": 6,
            "name": "CZK",
            "short": "Kč",
            "direction": true
        },
        {
            "id": 7,
            "name": "WON",
            "short": "₩",
            "direction": true
        },
        {
            "id": 8,
            "name": "CAD",
            "short": "$",
            "direction": false
        },
        {
            "id": 9,
            "name": "AUD",
            "short": "$",
            "direction": false
        },
        {
            "id": 10,
            "name": "SEK",
            "short": "kr",
            "direction": true
        },
        {
            "id": 11,
            "name": "BRL",
            "short": "R$",
            "direction": false
        },
        {
            "id": 12,
            "name": "MAD",
            "short": "د.م.",
            "direction": false
        },
        {
            "id": 13,
            "name": "ZAR",
            "short": "R ",
            "direction": false
        },
        {
            "id": 14,
            "name": "JPY",
            "short": "¥",
            "direction": false
        }
    ]
}

Dictionary: Country

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/country"
GET /partner-api/v1/country HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 1,
            "name": "Afghanistan"
        },
        {
            "id": 2,
            "name": "Albania"
        },
        {
            "id": 264,
            "name": "Poland"
        }
    ]
}

Dictionary: Product template

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/product-template"
GET /partner-api/v1/product-template HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 1,
            "name": "pizza"
        },
        {
            "id": 2,
            "name": "sushi"
        },
        {
            "id": 3,
            "name": "burgers"
        },
        {
            "id": 4,
            "name": "meal"
        },
        {
            "id": 5,
            "name": "bakeries"
        },
        {
            "id": 6,
            "name": "milk"
        },
        {
            "id": 7,
            "name": "vegetables"
        }
    ]
}

User

User: Get

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}"
GET /partner-api/v1/user/%7Bid%7D HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 113,
        "name": "test1@example.com",
        "email": "test1@example.com",
        "language": 1,
        "timezone": "Europe/Warsaw",
        "status": true,
        "added": "2020-08-07 08:00:20",
        "lastLogin": null,
        "companies": [
            {
                "id": 150,
                "user_id": 113,
                "name": "test company",
                "added": "2020-08-10 11:31:30",
                "email": "test1@example.com",
                "language": 1,
                "maxProducts": 10,
                "maxOrders": 500,
                "products": 1,
                "orders": 0,
                "ordersValuation": 0,
                "adminBlock": false
            }
        ]
    }
}

User: Add

curl -X POST -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
	"email": "test2@example.com",
	"password": "password123",
	"language": 1,
	"timezone": "Europe/Warsaw"
}' "https://cloud.miniorders.com/partner-api/v1/user"
POST /partner-api/v1/user HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
	"email": "test2@example.com",
	"password": "password123",
	"language": 1,
	"timezone": "Europe/Warsaw"
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 114,
        "name": "test2@example.com",
        "email": "test2@example.com",
        "language": 1,
        "timezone": "Europe/Warsaw",
        "admin": false
    }
}

User: Status

curl -X PUT -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "status": true
}' "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/status"
PUT /partner-api/v1/user/%7Bid%7D/status HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "status": true
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 114,
        "name": "test2@example.com",
        "email": "test2@example.com",
        "language": 1,
        "timezone": "Europe/Warsaw",
        "status": true
    }
}

User: Change password

curl -X PUT -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "password": "password123"
}' "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/password"
PUT /partner-api/v1/user/%7Bid%7D/password HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "password": "password123"
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 114,
        "name": "test2@example.com",
        "email": "test2@example.com",
        "language": 1,
        "timezone": "Europe/Warsaw",
        "admin": false
    }
}

User: Remove

curl -X DELETE -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}"
DELETE /partner-api/v1/user/%7Bid%7D HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok"
}

User: Sign in

curl -X POST -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "email": "test@example.com"
}' "https://cloud.miniorders.com/partner-api/v1/user/login-email"
POST /partner-api/v1/user/login-email HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "email": "test@example.com"
}
Status200 OK
{
    "status": "ok",
    "data": {
        "hash": "r2ff804l8azfke1mboayg3re1jskou1a",
        "url": "https://cloud.miniorders.com/login-otp/r2ff804l8azfke1mboayg3re1jskou1a"
    }
}

Company

Company: Get

curl -X GET -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/user/{id}/company/{cid}"
GET /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 150,
        "user_id": 113,
        "name": "test company",
        "added": "2020-08-10 11:31:30",
        "email": "test1@example.com",
        "language": 1,
        "maxProducts": 10,
        "maxOrders": 500,
        "products": 1,
        "orders": 0,
        "ordersValuation": 0,
        "adminBlock": false
    }
}

Company: Add

curl -X POST -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "name": "Test",
    "country": 1,
    "currency": 1,
    "subdomain": "a1aba1a112test1234a1",
    "maxProducts": 20,
    "maxOrders": 200,
    "language": 1,
    "email": "test@example.com",
    "description": "description",
    "address": "address",
    "postalCode": "00-000",
    "city": "city",
    "phone": "+48 123 321 123",
    "productTemplate": 1
}' "https://cloud.miniorders.com/partner-api/v1/user/{id}/company"
POST /partner-api/v1/user/%7Bid%7D/company HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "name": "Test",
    "country": 1,
    "currency": 1,
    "subdomain": "a1aba1a112test1234a1",
    "maxProducts": 20,
    "maxOrders": 200,
    "language": 1,
    "email": "test@example.com",
    "description": "description",
    "address": "address",
    "postalCode": "00-000",
    "city": "city",
    "phone": "+48 123 321 123",
    "productTemplate": 1
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 141,
        "name": "Test",
        "email": "test@example.com",
        "language": 1,
        "maxProducts": "20",
        "maxOrders": "200"
    }
}

Company: Limit change

curl -X PUT -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "maxProducts": 20,
    "maxOrders": 200
}' "https://cloud.miniorders.com/partner-api/v1/user/{id}/company/{cid}/limit"
PUT /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/limit HTTP/1.1
Host: cloud.miniorders.com
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "maxProducts": 20,
    "maxOrders": 200
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 146,
        "name": "Test",
        "email": "test@example.com",
        "language": 1,
        "maxProducts": "20",
        "maxOrders": "200"
    }
}

Company: Block

curl -X PUT -H "X-hmac: calculated_hmac" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "adminBlock": true
}' "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/company/{cid}/admin-block"
PUT /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/admin-block HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: calculated_hmac
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "adminBlock": true
}
Status200 OK
{
    "status": "ok",
    "data": {
        "id": 146,
        "user_id": 114,
        "name": "Test",
        "email": "test@example.com",
        "language": 1,
        "maxProducts": 20,
        "maxOrders": 200,
        "adminBlock": true
    }
}

Company: Payment types

curl -X GET -H "X-hmac: skip" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "https://cloud.miniorders.com/partner-api/v1/user/{id}/company/{cid}/payment-type"
GET /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/payment-type HTTP/1.1
Host: cloud.miniorders.com
X-hmac: skip
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 5,
            "name": "Cash on delivery"
        },
        {
            "id": 7,
            "name": "Card on delivery"
        }
    ]
}

Company: Products

curl -X GET -H "X-hmac: skip" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/company/{cid}/products"
GET /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/products HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: skip
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
{
    "status": "ok",
    "data": [
        {
            "id": 190,
            "name": "Pepperoni Pizza",
            "price": 100,
            "currency": {
                "id": 1,
                "name": "USD",
                "short": "$",
                "direction": false
            },
            "forSell": true,
            "tags": [
                {
                    "id": 83,
                    "name": "test1"
                },
                {
                    "id": 84,
                    "name": "test222"
                }
            ],
            "additions": [
                {
                    "id": 60,
                    "name": "Extra mozarella"
                },
                {
                    "id": 61,
                    "name": "Extra tomato sauce"
                }
            ],
            "priceOptions": [
                {
                    "id": 21,
                    "name": "test11",
                    "price": "100.00",
                    "main": true
                },
                {
                    "id": 22,
                    "name": "test22",
                    "price": "150.00",
                    "main": false
                }
            ]
        }
    ]
}

Company: Order types

curl -X GET -H "X-hmac: skip" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/company/{cid}/order-type"
GET /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/order-type HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: skip
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json
Status200 OK
Hostcloud.miniordersss.com:8000
DateTue, 01 Sep 2020 09:45:53 GMT
DateTue, 01 Sep 2020 09:45:53 GMT
Connectionclose
X-Powered-ByPHP/7.2.22
Cache-Controlno-cache
Content-Typeapplication/json
X-Debug-Token42a0b9
X-Debug-Token-Linkhttp://cloud.miniordersss.com:8000/_profiler/42a0b9
{
    "status": "ok",
    "data": [
        {
            "id": 1,
            "name": "Delivery"
        },
        {
            "id": 2,
            "name": "Personal pickup"
        }
    ]
}

Company: Add order

curl -X POST -H "X-hmac: skip" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "orderType": 1,
    "paymentType": 5,
    "street": "Testowa",
    "hn": "24",
    "fn": "11",
    "postalCode": "10-687",
    "city": "Olsztyn",
    "phone": "+48111111111",
    "email": "test@example.com",
    "products": [
        {
            "product": 190,
            "qt": 2,
            "tagId": 83,
            "additions": [61],
            "priceOption": 22
        }
    ]
}' "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/company/{cid}/order/add"
POST /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/order/add HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: skip
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "orderType": 1,
    "paymentType": 5,
    "street": "Testowa",
    "hn": "24",
    "fn": "11",
    "postalCode": "10-687",
    "city": "Olsztyn",
    "phone": "+48111111111",
    "email": "test@example.com",
    "products": [
        {
            "product": 190,
            "qt": 2,
            "tagId": 83,
            "additions": [61],
            "priceOption": 22
        }
    ]
}

Company: Invite member

curl -X POST -H "X-hmac: skip" -H "X-public: yybt8br6t20flh51hrjbzywcqj6swel3" -H "Content-type: application/json" -d '{
    "username": "test",
    "email": "test@example.com"
}' "http://cloud.miniordersss.com:8000/partner-api/v1/user/{id}/company/{cid}/member/add"
POST /partner-api/v1/user/%7Bid%7D/company/%7Bcid%7D/member/add HTTP/1.1
Host: cloud.miniordersss.com:8000
X-hmac: skip
X-public: yybt8br6t20flh51hrjbzywcqj6swel3
Content-type: application/json

{
    "username": "test",
    "email": "test@example.com"
}
Status200 OK
{
    "status": "ok"
}