- Add stock item
- Edit stock item
- View stock item details
- Get list of stock items
- Delete stock item
- Add stock movement
Adds item to stock
URL: /stock_items/add
HTTP method: POST
data='{
"StockItem":{
"description":"Public description of this item",
"hide_in_autocomplete":1,
"internal_comment":"Secret comment",
"name":"Item B",
"sku":"itemb1241",
"unit":"m",
"unit_price":19.95,
"purchase_unit_price":10.99,
"vat":20,
"watch_stock":1,
"stock":123
}
}';
curl -X POST \
-d "$data" \
-H "Content-Type: application/json" \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/add
none
name | type | description | default value |
---|---|---|---|
description | string | item description | |
hide_in_autocomplete | int | hide item in autocomplete (0=no, 1=yes) | |
internal_comment | string | internal comment - will not be displayed on invoice | |
name | string | item name | |
sku | string | unique identifier of stock item | |
stock | float | number of units in stock. If is not set, stock movements will not be watched | |
unit | string | unit, e.g.: pcs, mm, m2, ... | |
unit_price | float | unit price | |
purchase_unit_price | float | purchase unit price | |
vat | float | VAT in percent | |
watch_stock | int | track inventory level (0=no, 1=yes) |
{
"data": {
"StockItem": {
"description": "Public description of this item",
"hide_in_autocomplete": 1,
"id": "1",
"internal_comment": "Secret comment",
"name": "Item B",
"sku": "itemb1241",
"stock": 123,
"unit": "m",
"unit_price": 19.95,
"purchase_unit_price":10.99,
"vat": 20,
"watch_stock": 1
},
"StockLog": [
{
"log_data": "{\"purchase_unit_price\":10.99,\"purchase_vat\":null,\"purchase_currency\":null,\"unit_price\":19.95,\"vat\":20,\"currency\":null}",
"note": "Počiatočný stav skladu",
"quantity": 123
}
]
},
"error": 0,
"error_message": ""
}
Returns HTTP Status 400 (Bad request).
{
"error": 1,
"error_message": "Chýbajúce údaje",
"message": "Chýbajúce údaje"
}
Returns HTTP Status 403 (Forbidden).
{
"error": 1,
"error_message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu.",
"message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu."
}
Updates stock item
URL: /stock_items/edit/{ID}
HTTP method: PATCH
data='{
"StockItem":{
"name":"Item B",
"unit":"kg"
}
}';
curl -X PATCH \
-d "$data" \
-H "Content-Type: application/json" \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/edit/1
name | type | description | default value |
---|---|---|---|
id | int | stock item id |
name | type | description | default value |
---|---|---|---|
description | string | item description | |
hide_in_autocomplete | int | hide item in autocomplete (0=no, 1=yes) | |
internal_comment | string | internal comment - will not be displayed on invoice | |
name | string | item name | |
sku | string | unique identifier of stock item | |
stock | float | number of units in stock. If is not set, stock movements will not be watched | |
unit | string | unit, e.g.: pcs, mm, m2, ... | |
unit_price | float | unit price | |
vat | float | VAT in percent | |
watch_stock | int | track inventory level (0=no, 1=yes) |
{
"data": {
"StockItem": {
"created": "2050-01-01 23:59:59",
"description": "Public description of this item",
"hide_in_autocomplete": true,
"id": 1,
"import_id": null,
"import_type": null,
"internal_comment": "Secret comment",
"modified": "2050-01-01 23:59:59",
"name": "Item B",
"purchase_currency": null,
"purchase_unit_price": null,
"purchase_vat": null,
"sku": "itemb1241",
"stock": 123,
"stock_previous": 123,
"unit": "kg",
"unit_price": 19.95,
"user_id": "1",
"user_profile_id": "1",
"vat": 20,
"watch_stock": true
},
"StockLog": [
{
"log_data": "{\"purchase_unit_price\":\"\",\"purchase_tax\":null,\"purchase_exchange_rate\":1,\"purchase_country_exchange_rate\":1,\"purchase_currency\":null,\"unit_price\":\"19.95\",\"tax\":20,\"exchange_rate\":1,\"country_exchange_rate\":1,\"currency\":\"EUR\",\"home_currency\":\"EUR\"}",
"note": "Ručná úprava stavu na sklade",
"quantity": 0
}
]
},
"error": 0,
"error_message": ""
}
Returns HTTP status 403 (Forbidden).
{
"error": 1,
"error_message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu.",
"message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu."
}
Returns HTTP status 400 (Bad request).
{
"error": 2,
"error_message": "StockItem id not found.",
"message": "StockItem id not found."
}
Returns HTTP status 404 (Not found).
{
"error": 2,
"error_message": "StockItem not found.",
"message": "StockItem not found."
}
Get details about stock item.
URL: /stock_items/view/{ID}
HTTP method: GET
curl -X GET \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/view/1
URL parameters:
name | type | description | default value |
---|---|---|---|
id | int | stock item ID |
none
{
"StockItem": {
"created": "2050-01-01 23:59:59",
"description": "Public description of this item",
"hide_in_autocomplete": true,
"id": "1",
"import_id": null,
"import_type": null,
"internal_comment": "Secret comment",
"modified": "2050-01-01 23:59:59",
"name": "Item B",
"purchase_currency": null,
"purchase_unit_price": null,
"purchase_vat": null,
"sku": "itemb1241",
"stock": 123,
"unit": "m",
"unit_price": 19.95,
"user_id": "1",
"user_profile_id": "1",
"vat": 20,
"watch_stock": true
}
}
Returns HTTP status 404 (Not found).
{
"error": 1,
"error_message": "StockItem not found",
"message": "StockItem not found"
}
Return list of stock items.
URL: /stock_items/index.json[/{ATTRIBUTE}:{VALUE}]*
HTTP method: GET
curl -X GET \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/index.json
none
URL parameters:
name | type | description | default value |
---|---|---|---|
direction | string | sorting type, ASC or DESC | DESC |
listinfo | int | show meta information for results (0=no, 1=yes) | 0 |
page | int | page number | 1 |
per_page | int | number of results per page | |
price_from | float | price from | |
price_to | float | price to | |
search | string | searches substring in the following fields:
|
|
sku | string | search by sku (base64 encoded string: "itemb1241" = "aXRlbWIxMjQx") | |
sort | string | sorting attribute | 'regular_count' |
status | int | if 1 - shows only items that are in stock |
JSON array of objects
Fields:
name | type | description | default value |
---|---|---|---|
created | datetime | date and time of creation | |
description | string | item description (is displayed on invoice) | |
hide_in_autocomplete | bool | hide in autocomplete (null = no) | |
id | int | item ID | |
import_id | int | import ID (if is not from import = null) | |
import_type | string | import type ('efaktury' or null ) |
|
internal_comment | string | internal comment (isn't displayed on invoice) | |
modified | datetime | date and time of modification | |
name | string | item name | |
sku | int | stock item identifier (e.g. ABC123) | |
stock | float | number of items in stock | |
unit | string | unit (e.g. ks, kg) | |
unit_price | float | unit price | |
user_id | int | user ID | |
user_profile_id | int | user profile ID | |
vat | float | VAT in percent (e.g. 20) | |
watch_stock | bool | track inventory level |
[
{
"StockItem": {
"created": "2050-01-01 23:59:59",
"description": "Public description of this item",
"hide_in_autocomplete": true,
"id": "1",
"import_id": null,
"import_type": null,
"internal_comment": "Secret comment",
"modified": "2050-01-01 23:59:59",
"name": "Item B",
"purchase_currency": null,
"purchase_unit_price": null,
"purchase_vat": null,
"sku": "itemb1241",
"stock": 123,
"unit": "m",
"unit_price": 19.95,
"user_id": "1",
"user_profile_id": "1",
"vat": 20,
"watch_stock": true
}
}
]
{
"itemCount": 1,
"items": [
{
"StockItem": {
"created": "2050-01-01 23:59:59",
"description": "Public description of this item",
"hide_in_autocomplete": true,
"id": "1",
"import_id": null,
"import_type": null,
"internal_comment": "Secret comment",
"modified": "2050-01-01 23:59:59",
"name": "Item B",
"purchase_currency": null,
"purchase_unit_price": null,
"purchase_vat": null,
"sku": "itemb1241",
"stock": 123,
"unit": "m",
"unit_price": 19.95,
"user_id": "1",
"user_profile_id": "1",
"vat": 20,
"watch_stock": true
}
}
],
"page": 1,
"pageCount": 1,
"perPage": 50
}
Delete stock item
URL: /stock_items/delete/{ID}
HTTP method: DELETE
curl -X DELETE \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/delete/1
URL parameters:
name | type | description | default value |
---|---|---|---|
id | int | stock item ID |
none
{
"data": {
"StockItem": {
"created": "2050-01-01 23:59:59",
"description": "Public description of this item",
"hide_in_autocomplete": true,
"id": "1",
"import_id": null,
"import_type": null,
"internal_comment": "Secret comment",
"modified": "2050-01-01 23:59:59",
"name": "Item B",
"purchase_currency": null,
"purchase_unit_price": null,
"purchase_vat": null,
"sku": "itemb1241",
"stock": 123,
"unit": "m",
"unit_price": 19.95,
"user_id": "1",
"user_profile_id": "1",
"vat": 20,
"watch_stock": true
}
},
"error": 0,
"error_message": ""
}
Returns HTTP status 400 (Bad request).
{
"error": 1,
"error_message": "Invalid stock item id",
"message": "Invalid stock item id"
}
Returns HTTP status 404 (Not found).
{
"error": 1,
"error_message": "StockItem not found",
"message": "StockItem not found"
}
Returns HTTP status 500 (Internal server error)
{
"error": 2,
"error_message": "Error deleting stock item."
}
Returns HTTP status 403 (Forbidden).
{
"error": 1,
"error_message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu.",
"message": "Ako používateľ typu Hosť nemáte oprávnenie na túto akciu."
}
URL: /stock_items/addStockMovement
HTTP method: POST
data='{
"StockLog":[
{
"currency":"EUR",
"purchase_currency":"SEK",
"purchase_unit_price":0.97,
"purchase_tax":22,
"quantity":5,
"sku":"itemb1241",
"unit_price":1.23,
"tax":25
}
]
}';
curl -X POST \
-d "$data" \
-H "Content-Type: application/json" \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/addStockMovement
none
Either sku
or stock_item_id
is required.
name | type | description | default value |
---|---|---|---|
created | date | date of movement in YYYY-MM-DD |
<current> |
note | string | description of movement | |
purchase_currency | string | ||
purchase_unit_price | float | ||
purchase_tax | float | VAT | |
quantity | float | negative number = outgo, positive = income | 1 |
sku | string | unique stock item identifier | |
stock_item_id | int | stock item ID to which movement will be assigned | |
unit_price | float | stock item ID to which movement will be assigned | |
tax | float | VAT |
{
"data": {
"StockLog": [
{
"currency": "EUR",
"id": 0,
"log_data": "{\"purchase_unit_price\":0.97,\"purchase_tax\":22,\"purchase_currency\":\"SEK\",\"unit_price\":1.23,\"tax\":25,\"currency\":\"EUR\"}",
"purchase_currency": "SEK",
"purchase_tax": 22,
"purchase_unit_price": 0.97,
"quantity": 5,
"sku": "itemb1241",
"stock_item_id": "1",
"tax": 25,
"unit_price": 1.23
}
]
},
"error": 0,
"error_message": ""
}
{
"error": 3,
"error_message": "StockItem empty data."
}
URL: /stock_items/movements/{ID}
HTTP method: GET
curl -X GET \
-H "Authorization: SFAPI email=api%40example.com&apikey=c0a4cdcdfe98ca660942d60cf7896de6&company_id=123" \
https://moja.superfaktura.sk/stock_items/movements/1
URL parameters:
name | type | description | default value |
---|---|---|---|
id | int | stock item ID |
URL parameters:
name | type | description | default value |
---|---|---|---|
direction | string | sorting type, ASC or DESC | ASC |
page | int | page number | 1 |
per_page | int | number of results per page | |
sort | string | sorting attribute |
{
"itemCount": 9,
"pageCount": 5,
"perPage": 2,
"page": 2,
"items": [
{
"StockLog": {
"id": "1",
"stock_item_id": "9",
"user_id": "22",
"user_profile_id": "12",
"invoice_id": null,
"expense_id": null,
"document_item_id": null,
"quantity": 0,
"note": "Ručná úprava stavu na sklade",
"document": null,
"document_subtype": null,
"log_data": "{\"purchase_unit_price\":\"0.1200\",\"purchase_tax\":null,\"purchase_exchange_rate\":1,\"purchase_country_exchange_rate\":1,\"purchase_currency\":null,\"unit_price\":\"0.1\",\"tax\":20,\"exchange_rate\":1,\"country_exchange_rate\":1,\"currency\":\"EUR\",\"home_currency\":\"EUR\"}",
"created": "2050-10-10 09:27:17",
"modified": "2050-10-10 09:27:17"
}
},
{
"StockLog": {
"id": "2",
"stock_item_id": "9",
"user_id": "22",
"user_profile_id": "12",
"invoice_id": null,
"expense_id": null,
"document_item_id": null,
"quantity": 2,
"note": "Test",
"document": null,
"document_subtype": null,
"log_data": "{\"purchase_unit_price\":\"0.1200\",\"purchase_tax\":null,\"purchase_exchange_rate\":1,\"purchase_country_exchange_rate\":1,\"purchase_currency\":null,\"unit_price\":\"0.1\",\"tax\":20,\"exchange_rate\":1,\"country_exchange_rate\":1,\"currency\":\"EUR\",\"home_currency\":\"EUR\"}",
"created": "2050-10-10 09:27:25",
"modified": "2050-10-10 09:27:25"
}
}
]
}
Returns HTTP status 404 (Not found).
{
"error": 1,
"error_message": "StockItem not found",
"message": "StockItem not found"
}