Introduction
Welcome to POSko API documentation. POSko is under active development. Expect breaking changes on each commit. We encourage you to reset your database before running migrations.
This API contains basic functionalities and exposes unfiltered data. Requests may
return sensitive information like password_digest
and other keys but those
are intentional. Those keys will be removed when the core functionalities are ready.
Authentication
Sign In
This request will return a JSON similar to this
{
"user": {
"email": "admin@first_company.com",
"token": "t4s7yrtGqKKfwvQik9WgKFyN",
"auth_token": "8CWo9VBGV7WEUxhgvuKRrhv4",
"created_at": "2018-05-10T13:01:11.560Z"
}
}
Use using Basic authentication
HTTP Request
POST /api/v1/sign_in
Paramaters
Parameter | Type | Description |
---|---|---|
account_name |
String | The account name of the user. ex: the_green_store |
email |
String | The email address of the user |
password |
String | Password of the user |
Response
Parameter | Type | Description |
---|---|---|
token |
String | A unique token that will serve as the username in Basic Auth |
auth_token |
String | The password |
This endpoint returns the necessary tokens to be used in your future requests
Users
Get all users
curl --request GET \
--url 'http://example.com/api/v1/users' \
--header 'Authorization: <Processed Basic hash>' \
--header 'Content-Type: application/json' \
HTTP Request
{
"users": [
{
"id": 1,
"account_id": 1,
"email": "admin@first_company.com",
"first_name": "Juan",
"middle_name": null,
"last_name": "Dela Cruz",
"suffix": null,
"title": null,
"password_digest": "$2a$10$o2IBZrnngsb6gWMxNthU6OwH2Cz1yNwZr5pyGaoQFL8NPlHUogAzG",
"user_type": null,
"user_status": 0,
"token": "Qt4KrDQyzMWA4AwPJ5qEXdsS",
"status": "active",
"created_at": "2018-05-10T13:01:11.560Z",
"updated_at": "2018-05-10T13:01:11.560Z"
}
]
}
GET /api/v1/users
Response
Key | Type | Description |
---|---|---|
users |
Array | Collection of users |
Access Keys
Get access keys of current customer
curl --request GET \
--url 'http://example.com/api/v1/access_keys' \
--header 'Authorization: <Processed Basic hash>' \
--header 'Content-Type: application/json' \
HTTP Request
{
"access_keys": [
{
"id": 1,
"user_id": 1,
"token": "eJfds7aZbTYoxKMDZSFXD6Ad",
"auth_token": "sLMaNwwkrMEa4CA6YVYGCKm2",
"access_key_status": 0,
"status": "active",
"created_at": "2018-05-20T07:20:56.863Z",
"updated_at": "2018-05-20T07:20:56.863Z"
}
]
}
GET /api/v1/access_keys
Response
Key | Type | Description |
---|---|---|
access_keys | Array | Collection of tokens |
Customers
Get all customers
curl --request GET \
--url 'http://example.com/api/v1/customers' \
--header 'Authorization: <Processed Basic hash>' \
--header 'Content-Type: application/json' \
HTTP Request
{
"customers": [
{
"id": 1,
"account_id": 1,
"default_address_id": null,
"first_name": "Cardo",
"middle_name": null,
"last_name": "Dalisay",
"email": "cardo@dalisay.com",
"suffix": null,
"note": null,
"customer_type": 0,
"customer_status": 0,
"status": "active",
"created_at": "2018-05-23T14:29:38.391Z",
"updated_at": "2018-05-23T14:29:38.391Z"
}
]
}
GET /api/v1/customers
Response
Key | Type | Description |
---|---|---|
customers |
Array | Collection of customers |
Create Customer
HTTP Request
{
"customer": {
"id": 1,
"account_id": 1,
"default_address_id": null,
"first_name": "Cardo",
"middle_name": null,
"last_name": "Dalisay",
"email": "cardo@dalisay.com",
"suffix": null,
"note": null,
"customer_type": 0,
"customer_status": 0,
"status": "active",
"created_at": "2018-05-23T14:29:38.391Z",
"updated_at": "2018-05-23T14:29:38.391Z"
}
}
POST /api/v1/customers
Get Customer
HTTP Request
{
"customer": {
"id": 1,
"account_id": 1,
"default_address_id": null,
"first_name": "Cardo",
"middle_name": null,
"last_name": "Dalisay",
"email": "cardo@dalisay.com",
"suffix": null,
"note": null,
"customer_type": 0,
"customer_status": 0,
"status": "active",
"created_at": "2018-05-23T14:29:38.391Z",
"updated_at": "2018-05-23T14:29:38.391Z"
}
}
POST /api/v1/customers
Products
This resource enables you to retrieve product information
General Actions
Detailed information about these endpoints are down below - GET /api/v1/products - GET /api/v1/products/:id
Endpoints
GET /api/v1/products
Retrieves a list of product
Parameter | Type | Description |
---|---|---|
ids | Array | An array of ids to be retrieved |
limit | Integer | The number of results per page |
page | Integer | The page to be retrieved |
since_id | Integer | Retrieves data after the specified id |
GET /api/v1/products/:id
Retrieves info of a product
Paramater | Type | Description |
---|---|---|
:id | Integer | The unique id of the product |
Orders
Get all orders
curl --request GET \
--url 'http://example.com/api/v1/orders' \
--header 'Authorization: <Processed Basic hash>' \
--header 'Content-Type: application/json' \
HTTP Request
{
"orders": [
{
"id": 1,
"account_id": 1,
"default_address_id": null,
"first_name": "Cardo",
"middle_name": null,
"last_name": "Dalisay",
"email": "cardo@dalisay.com",
"suffix": null,
"note": null,
"customer_type": 0,
"customer_status": 0,
"status": "active",
"created_at": "2018-05-23T14:29:38.391Z",
"updated_at": "2018-05-23T14:29:38.391Z"
}
]
}
GET /api/v1/orders
Response
Key | Type | Description |
---|---|---|
orders |
Array | Collection of orders |
Create Order
HTTP Request
{
"order": {
"id": 1,
"account_id": 1,
"customer_id": 1,
"user_id": 1,
"order_number": 25,
"note": null,
"total_line_items_price": "0.0",
"total_discounts": "0.0",
"subtotal": "0.0",
"total_price": "0.0",
"total_tax": "0.0",
"total_weight": "0.0",
"first_name": null,
"middle_name": null,
"last_name": null,
"email": null,
"contact_number": null,
"suffix": null,
"fulfillment_status": 0,
"order_status": 0,
"status": "active",
"created_at": "2018-05-24T14:46:40.559Z",
"updated_at": "2018-05-24T14:46:40.559Z"
}
}
POST /api/v1/orders
Get Order
HTTP Request
{
"order": {
"id": 1,
"account_id": 1,
"customer_id": 1,
"user_id": 1,
"order_number": 25,
"note": null,
"total_line_items_price": "0.0",
"total_discounts": "0.0",
"subtotal": "0.0",
"total_price": "0.0",
"total_tax": "0.0",
"total_weight": "0.0",
"first_name": null,
"middle_name": null,
"last_name": null,
"email": null,
"contact_number": null,
"suffix": null,
"fulfillment_status": 0,
"order_status": 0,
"status": "active",
"created_at": "2018-05-24T14:46:40.559Z",
"updated_at": "2018-05-24T14:46:40.559Z"
}
}
POST /api/v1/orders