/customer/{customerId}/items v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
Customers
getCustomerIdItems
Code samples
const headers = {
Accept: "application/json",
};
fetch("https://goldleaf.app/api/v1/customer/{customerId}/items", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
GET /customer/{customerId}/items
Get customer items
Retrieves a paginated list of active items associated with a specific customer within the user's organization. Supports filtering by brand, part number, organization-specific part number, and item type. Access is blocked for users with the customer role.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| customerId | path | string | true | MongoDB ObjectId of the customer |
| page | query | integer | false | Page number for pagination |
| itemsPerPage | query | integer | false | Number of items per page |
| sortBy[0].key | query | string | false | Field to sort by (default is partNumber) |
| sortBy[0].order | query | string | false | Sort order (ascending or descending, default is asc) |
| search[brand] | query | string | false | Filter items by brand name |
| search[partNumber] | query | string | false | Filter items by part number |
| search[orgPartNumber] | query | string | false | Filter items by organization-specific part number |
| search[itemType] | query | string | false | Filter items by item type |
Enumerated Values
| Parameter | Value |
|---|---|
| sortBy[0].key | partNumber |
| sortBy[0].key | lastModified |
| sortBy[0].order | asc |
| sortBy[0].order | desc |
Example responses
500 Response
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "No items available"
},
"image": {
"type": "string",
"nullable": true,
"example": null
}
}
}
},
"total": {
"type": "integer",
"example": 0
}
}
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Paginated list of customer items | None |
| 500 | Internal Server Error | Default empty response | Inline |
Response Schema
Status Code 500
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » items | [object] | false | none | none |
| »» name | string | false | none | none |
| »» image | string¦null | false | none | none |
| » total | integer | false | none | none |
