# Suppliers
Suppliers are the people or companies that provide inventory items to the business.
# The Supplier Object
# Sample
{
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the supplier. | |
name* | string | updatable | Name of the supplier. |
contact_name | string | updatable | Name of the contact person. |
phone | string | updatable | Phone of the supplier. |
code | string | updatable | Code of the supplier. |
email | string | updatable | Email of the supplier. |
items | array | nullable updatable includable | List of Inventory Item objects attached to the supplier. |
tags | array | nullable updatable includable | List of Tag objects attached to the supplier. |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was created. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was updated. |
deleted_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was deleted. |
# Supplier Item Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | The Inventory Item object id. | |
pivot | object | The relationship details between supplier and inventory item. | |
pivot.order_unit | string | updatable | The unit used in purchase orders and purchasing from the given supplier. |
pivot.order_to_storage_factor | double | updatable | The conversion factor between order and storage units. |
pivot.minimum_order_quantity | double | updatable | Purchase orders must have quantity greater than or equal to minimum order quantity in order unit. |
pivot.cost | double | updatable | Unit cost of inventory item. |
pivot.code | string | updatable | Code of the inventory item. |
# List Suppliers
GET /suppliers
# Scope
inventory.settings.read
# Filters
namecontact_nameemailphonecodeidtags.iditems.idupdated_afteris_deletedcreated_onupdated_ondeleted_on
# Response
{
"data": [
{
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
]
}
# Get Supplier
GET /suppliers/{supplierId}
# Scope
inventory.settings.read
# Response
{
"data": {
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
}
# Create Supplier
POST /suppliers
# Scope
inventory.settings.write
# Request
{
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"email": "jonatan@mail.com",
"code": "511612",
"tags": [
{
"id": "8cd1956b"
}
]
}
# Response
{
"data": {
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
}
# Update Supplier
PUT /suppliers/{supplierId}
# Scope
inventory.settings.write
# Request
{
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"email": "jonatan@mail.com",
"code": "511612",
"tags": [
{
"id": "8cd1956b"
}
]
}
# Response
{
"data": {
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
}
# Delete Supplier
DELETE /suppliers/{supplierId}
# Scope
inventory.settings.write
The API will respond with 200 indicating that the supplier has been deleted.
# Restore Supplier
PUT /suppliers/{supplierId}/restore
# Scope
inventory.settings.write
The API will respond with 200 indicating that the supplier has been restored.
# Attach Inventory Item to Supplier
POST /suppliers/{supplierId}/items/{inventoryItemId}
# Scope
inventory.settings.write
The order_unit & order_to_storage_factorattributes are required.
# Request
{
"order_unit": "box",
"order_to_storage_factor": 5,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
}
# Response
{
"data": {
"id": "8d14e4b0",
"name": "Food Inc.",
"contact_name": "Jonatan",
"phone": "2362056789",
"code": "1234",
"email": "jonatan@mail.com",
"items": [
{
"pivot": {
"order_unit": "Kg",
"order_to_storage_factor": 1,
"minimum_order_quantity": 10,
"cost": 5,
"code": "ABC123"
},
"id": "8f7b9b1d"
}
],
"tags": [
{
"id": "8f7b9463",
"pivot": {
"supplier_id": "8f7c0b3",
"tag_id": "8f7b9463"
}
}
],
"created_at": "2019-02-26 19:19:16",
"updated_at": "2019-02-26 19:19:16",
"deleted_at": null
}
}
# Remove Inventory Item from Supplier
DELETE /suppliers/{supplierId}/items/{inventoryItemId}
# Scope
inventory.settings.write
The API will respond with 200 indicating that the item to supplier link has been removed.