Vendors
Vendors in Kojo represent the external business entities your business buys goods and services from. They are concepually synonomous with the concept of Vendors in many accounting systems (Spectrum, QuickBooks, etc.). An additional nuance to the concept of Vendors in Kojo are Vendor Contacts, who are specific contacts at the vendor organization.
Vendor Schema​
Vendor
​
Name | Type | Description | Example |
---|---|---|---|
id | ID | Unique identifier for orders | "ckmnpybisiy5x08abky4g2d1f" |
name | string | User defined name for the vendor | "Dunder Mifflin" |
code | string | Vendor Code | "ACE123" |
location | Location | The location associated with this vendor | See Location docs |
createdAt | dateTime | When this object was created | "2021-03-24 17:26:46.983Z" |
deletedAt | dateTime | When this object was deleted | "2021-03-24 17:26:46.983Z" |
updatedAt | dateTime | When this object was last updated | "2021-03-24 17:26:46.983Z" |
Queries​
vendor
​
Read a single vendor. You must specify either the vendor ID or the vendor code.
Parameters​
Name | Description | Example |
---|---|---|
id | The ID of the vendor to fetch | "ckmnpybisiy5x08abky4g2d1f" |
code | The code of the vendor to fetch | "ACE123" |
Response​
A single Vendor
object.
Example Query​
query {
vendor(code: "ACE123") {
id
name
code
}
}
Example Response​
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin",
"code": "ACE123"
}
vendors
​
Get all vendors, with pagination.
Parameters​
Accepts all standard pagination parameters.
Allowed orderBy fields: code
(default), createdAt
, id
, name
, updatedAt
.
Allowed filter fields: code
, createdAt
, id
, name
, updatedAt
.
Response​
A list of Vendor
objects.
Example Query​
query {
vendors(direction: ASC, orderBy: name) {
id
name
code
}
}
Example Response​
[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin",
"code": "ACE123"
},
{
"id": "ckmnpybisiy5x234klj3lk4jf",
"name": "Penn Steel",
"code": "858858"
},
]
Mutations​
createVendor
​
Creates a new vendor.
Parameters​
Name | Type | Description | Example |
---|---|---|---|
code | string | Vendor Code | "ACE123" |
name | string | User defined name for the vendor | "Dunder Mifflin" |
Response​
The created Vendor
.
Example Mutation​
mutation {
createVendor(
code: "ACE123"
name: "Dunder Mifflin"
) {
code
id
name
}
}
Example Response​
{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin"
}
updateVendor
​
Update a vendor.
Parameters​
Name | Type | Description | Example |
---|---|---|---|
id | ID | ID of the vendor to update | "ckmnpybisiy5x08abky4g2d1f" |
code | string | Code of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value. | "ACE123" |
name | string | User defined name for the vendor | "Dunder Mifflin" |
One of id
or code
is required.
Response​
The updated Vendor
.
Example Mutation​
mutation {
updateVendor(
id: "ckmnpybisiy5x08abky4g2d1f"
name: "Dunder Mifflin (edited)"
) {
code
id
name
}
}
Example Response​
{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin (edited)"
}
upsertVendors
​
Creates or Updates multiple Vendors at once.
Parameters​
Name | Type | Description |
---|---|---|
inputs | UpsertVendorInput[] | A list of vendors |
UpsertVendorInput​
Name | Type | Description | Example |
---|---|---|---|
code | string | Code of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value. | "ACE123" |
name | string | User defined name for the vendor | "Dunder Mifflin" |
Response​
A list of Vendors
.
Example Mutation​
mutation {
upsertVendors(
inputs: [
{
id: "ckmnpybisiy5x08abky4g2d1f",
name: "Dunder Mifflin (edited)"
}
]
) {
code
id
name
}
}
Example Response​
[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"code": "ACE123",
"name": "Dunder Mifflin (edited)"
}
]
addLocationToVendor
​
Attaches a location to the vendor.
Parameters​
Name | Type | Description | Example |
---|---|---|---|
locationId | ID | (required) ID of the location to attach to the vendor | "ckmnpybisiy5x08abky4g2d1f" |
id | ID | ID of the vendor to update | "ckmnpybisiy5x08abky4g2d1f" |
code | string | Code of vendor to update | "ACE123" |
One of id
or code
is required.
Response​
The updated Vendor
.
Example Mutation​
mutation {
addLocationToVendor(
vendorId: "ckmnpybisiy5x08abky4g2d1f"
locationId: "af35pf4taiygadxafd23g8hga"
) {
code
id
name
}
}
Example Response​
{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin"
}
deleteVendor
​
Deletes a vendor.
Parameters​
Name | Type | Description | Example |
---|---|---|---|
id | ID | ID of the vendor to update | "ckmnpybisiy5x08abky4g2d1f" |
code | string | Code of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value. | "ACE123" |
One of id
or code
is required.
Response​
The deleted Vendor
.
Example Mutation​
mutation {
deleteVendor(
id: "ckmnpybisiy5x08abky4g2d1f"
) {
code
id
name
}
}
Example Response​
{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin (edited)",
}