/workorder/{workOrderId}/addline 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:
Work Orders
postWorkOrderIdAddLine
Code samples
const inputBody = '{
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"quantity": {
"type": "number",
"description": "Quantity of the line item",
"nullable": true
},
"lineNumber": {
"type": "number",
"description": "Line number of the item",
"nullable": true
},
"comments": {
"type": "string",
"description": "Additional comments",
"nullable": true
},
"itemType": {
"type": "string",
"description": "Type of the item",
"nullable": true
},
"salesOrder": {
"type": "string",
"description": "Sales order reference",
"nullable": true
},
"purchaseOrder": {
"type": "string",
"description": "Purchase order reference",
"nullable": true
},
"itemId": {
"type": "string",
"description": "ID of the item (MongoDB ObjectId)",
"pattern": "^[a-f\\d]{24}$",
"example": "60c72b2f9b1e8e4f12345678"
}
}
}
},
"required": [
"itemId"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':{
"type": "string"
}
};
fetch('https://goldleaf.app/api/v1/workorder/{workOrderId}/addline',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /workorder/{workOrderId}/addline
Adds a new line item to the specified work order
Body parameter
{
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"quantity": {
"type": "number",
"description": "Quantity of the line item",
"nullable": true
},
"lineNumber": {
"type": "number",
"description": "Line number of the item",
"nullable": true
},
"comments": {
"type": "string",
"description": "Additional comments",
"nullable": true
},
"itemType": {
"type": "string",
"description": "Type of the item",
"nullable": true
},
"salesOrder": {
"type": "string",
"description": "Sales order reference",
"nullable": true
},
"purchaseOrder": {
"type": "string",
"description": "Purchase order reference",
"nullable": true
},
"itemId": {
"type": "string",
"description": "ID of the item (MongoDB ObjectId)",
"pattern": "^[a-f\\d]{24}$",
"example": "60c72b2f9b1e8e4f12345678"
}
}
}
},
"required": ["itemId"]
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Bearer token for authorization |
| workOrderId | path | string | true | Work order ID to add the line item to (MongoDB ObjectId) |
| body | body | object | true | Details of the line item to add |
| » params | body | object | false | none |
| »» quantity | body | number¦null | false | Quantity of the line item |
| »» lineNumber | body | number¦null | false | Line number of the item |
| »» comments | body | string¦null | false | Additional comments |
| »» itemType | body | string¦null | false | Type of the item |
| »» salesOrder | body | string¦null | false | Sales order reference |
| »» purchaseOrder | body | string¦null | false | Purchase order reference |
| »» itemId | body | string | false | ID of the item (MongoDB ObjectId) |
Example responses
403 Response
{
"type": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Line item added successfully | None |
| 403 | Forbidden | Forbidden - insufficient permissions or blocked user role | string |
| 500 | Internal Server Error | none | string |
