-
Notifications
You must be signed in to change notification settings - Fork 0
API
All methods that are not marked as no token needed must be executed with Token header presented. Token header must be filled with existing token that was taken after authentication step.
Exceptions: INVALID_ACCESS_TOKEN, NO_ACCESS_TOKEN
Note: no token needed
Request: POST /auth
Request body:
{
!"vk_access_token": STRING,
!"vk_user_id": INTEGER,
!"ruber_app_id": INT,
!"ruber_app_secret": STRING
}Request headers:
Accept=application/json
Content-Type=application/json
Response:
{
!"ruber_access_token": STRING,
!"id": INT
}Exceptions: INVALID_EXTERNAL_APP_CREDENTIALS
Request: POST /orders
Request headers: Content-Type=application/json
Request body:
{
!"title": STRING,
"description": STRING,
!"status": ENUM("WAITING", "PAID", "DONE", "CANCELLED"),
"deadline_timestamp": LONG or NULL,
!"customer": {
!"name": STRING,
!"phone": STRING,
"vk_id": INTEGER or NULL
},
"shipment": {
!"address": STRING,
!"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
"discount": {
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
!"item_replicas": [
{
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER
},
...
],
!"vk_item_replicas": [
{
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER,
!"vk_id": INTEGER,
!"vk_owner_id": INTEGER
},
...
]
}Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/11
Request: GET /orders/{id}
Request headers: Accept=application/json
Response:
{
!"id": INTEGER,
!"title": STRING,
"description": STRING,
!"status": ENUM("WAITING", "PAID", "DONE", "CANCELLED"),
!"created_timestamp": LONG,
!"deadline_timestamp": LONG or NULL,
!"customer": {
!"name": STRING,
!"phone": STRING,
!"vk_id": INTEGER or NULL
},
!"shipment": NULL or {
!"address": STRING,
!"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
!"discount": NULL or {
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
!"item_replicas": [
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER
},
...
],
!"vk_item_replicas": [
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER,
!"vk_id": INTEGER,
!"vk_owner_id": INTEGER
},
...
]
}Exceptions: NO_SUCH_ORDER
Request: GET /orders
Request headers: Accept=application/json
Response:
[
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"status": ENUM("WAITING", "PAID", "DONE", "CANCELLED"),
!"order_positions": INTEGER,
!"pinned_items": INTEGER
},
...
]Request: PUT /orders/{id}
Request headers: Content-Type=application/json
Request body:
{
"title": STRING,
"description": STRING,
"status": ENUM("WAITING", "PAID", "DONE", "CANCELLED"),
"deadline_timestamp": LONG or NULL,
"discount": NULL or {
"title": STRING,
"description": STRING,
"thumb_photo": URL e.g. "http://google.com/pic1",
"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
"shipment": NULL or {
"address": STRING,
"cost": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99"
},
"customer": {
"name": STRING,
"phone": STRING,
"vk_id": INTEGER or NULL
}
}Response status: 200 OK
Exceptions: INVALID_REQUEST_JSON, NO_SUCH_ORDER, NOT_ENOUGH_ARGUMENTS if you try to create(not update) discount or shipment or deadline_timestamp but not specified some fields.
Request: GET /orders/{order_id}/item_replicas/{replica_id}
Request headers: Accept=application/json
Response body:
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER
}Exceptions: NO_SUCH_ORDER, NO_SUCH_ORDER_POSITION
Request: GET /orders/{order_id}/item_replicas
Request headers: Accept=application/json
Response body:
[
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER
},
...
]Exceptions: NO_SUCH_ORDER
Request: DELETE /orders/{order_id}/item_replicas/{replica_id}
Response status: 204 NO CONTENT
Exceptions: NO_SUCH_ORDER, NO_SUCH_ORDER_POSITION
Request: POST /orders/{order_id}/item_replicas
Request headers: Content-Type=application/json
Request body:
{
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER
}Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/11/item_replicas/14
Exceptions: NO_SUCH_ORDER
Request: GET /orders/{order_id}/vk_item_replicas/{replica_id}
Request headers: Accept=application/json
Response body:
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER,
!"vk_id": INTEGER,
!"vk_owner_id": INTEGER
}Exceptions: NO_SUCH_ORDER, NO_SUCH_ORDER_POSITION
Request: GET /orders/{order_id}/vk_item_replicas
Request headers: Accept=application/json
Response body:
[
{
!"id": INTEGER,
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER,
!"vk_id": INTEGER,
!"vk_owner_id": INTEGER
},
...
]Exceptions: NO_SUCH_ORDER
Request: DELETE /orders/{order_id}/vk_item_replicas/{replica_id}
Response status: 204 NO CONTENT
Exceptions: NO_SUCH_ORDER, NO_SUCH_ORDER_POSITION
Request: POST /orders/{order_id}/vk_item_replicas
Request headers: Content-Type=application/json
Request body:
{
!"title": STRING,
!"description": STRING,
!"thumb_photo": URL e.g. "http://google.com/pic1",
!"price": POSITIVE BIGDECIMAL(scale = 2) e.g. "14.99",
!"amount": INTEGER,
!"vk_id": INTEGER,
!"vk_owner_id": INTEGER
}Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/11/vk_item_replicas/14
Exceptions: NO_SUCH_ORDER
Request: GET /orders/{order_id}/pinned_messages/{message_id}
Request headers: Accept=application/json
Response body:
{
!"id": INTEGER,
!"position": INTEGER,
!"vk_message_id": LONG,
!"created_timestamp": LONG
}Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: GET /orders/{order_id}/pinned_messages
Request headers: Accept=application/json
Response body:
[
{
!"id": INTEGER,
!"position": INTEGER,
!"vk_message_id": LONG,
!"created_timestamp": LONG
},
...
]Exceptions: NO_SUCH_ORDER
Request: DELETE /orders/{order_id}/pinned_messages/{message_id}
Response status: 204 NO CONTENT
Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: POST /orders/{order_id}/pinned_messages
Request headers: Content-Type=application/json
Request body:
{
!"position": INTEGER,
!"vk_message_id": LONG
}Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/11/pinned_messages/14
Exceptions: NO_SUCH_ORDER
Request: GET /orders/{order_id}/pinned_texts/{text_id}
Request headers: Accept=application/json
Response body:
{
!"id": INTEGER,
!"position": INTEGER,
!"text": STRING,
!"created_timestamp": LONG
}Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: GET /orders/{order_id}/pinned_texts
Request headers: Accept=application/json
Response body:
[
{
!"id": INTEGER,
!"position": INTEGER,
!"text": STRING,
!"created_timestamp": LONG
},
...
]Exceptions: NO_SUCH_ORDER
Request: DELETE /orders/{order_id}/pinned_texts/{text_id}
Response status: 204 NO CONTENT
Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: POST /orders/{order_id}/pinned_texts
Request headers: Content-Type=application/json
Request body:
{
!"position": INTEGER,
!"text": STRING
}Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/11/pinned_texts/14
Exceptions: NO_SUCH_ORDER
Request: GET /orders/{order_id}/pinned_files/{file_id}
Request headers: Accept=application/json
Response body:
{
!"id": INTEGER,
!"position": INTEGER,
!"file_name": STRING,
!"created_timestamp": LONG
}Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: GET /orders/{order_id}/pinned_files
Request headers: Accept=application/json
Response body:
[
{
!"id": INTEGER,
!"position": INTEGER,
!"file_name": STRING,
!"created_timestamp": LONG
},
...
]Exceptions: NO_SUCH_ORDER
Request: GET /orders/{order_id}/pinned_files/{file_id}/content
Request headers: Accept=application/octet-stream
Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
Request: DELETE /orders/{order_id}/pinned_files/{file_id}
Response status: 204 NO CONTENT
Exceptions: NO_SUCH_ORDER, NO_SUCH_PINNED_ITEM
NOTE! This is a multipart request. You must follow the appropriate standart
Request: POST /orders/{order_id}/pinned_files/{file_id}
Request headers: Accept=application/json, Content-Type=multipart/form-data; boundary={boundary}
Request body: link
Request notes: do not forget about the boundary in Content-Type=multipart/form-data header. You must set the position parameter for this pinned file in requeset body. See the request body link.
Response status: 201 CREATED
Response headers: Location: http://185.12.95.60:8081/ruber/orders/12/pinned_files/43
Exceptions: NO_SUCH_ORDER, MULTIPART_IO_EXCEPTION
Request: GET /connected_groups
Request headers: Accept=application/json
Response body:
[
INTEGER,
INTEGER,
INTEGER,
...
]Request: POST /connected_groups
Request headers: Content-Type=application/json
Request body:
{
!"vk_group_id": INTEGER
}Response status: 201 CREATED
Exceptions: INVALID_REQUEST_JSON if vk_group_id is missed or null
Request: DELETE /connected_groups/{vk_group_id}
Response status: 204 NO CONTENT