/invoice/create
This action creates an invoice for a work order. Only one invoice can
be created for a work order; use the
/invoice/update action to update an existing
invoice.
WARNING: This endpoint is deprecated. Please use the
invoice/updateendpoint to make changes to Invoices. All Work Orders will now always have an Invoice, so there’s no lorger a need to manually create one.
Request
| Field | Description | Type | Required |
|---|---|---|---|
report_id | Unique identifier for the work order | number | Yes |
contractor_items | Contractor invoice items | array | No |
client_items | Client invoice items | array | No |
Each item in the contractor_items / client_items array can have
the following fields:
| Field | Description | Type | Required |
|---|---|---|---|
invoice_item_id | Unique identifier for the invoice item. See /bid/invoice/items | number | Yes, if creating an invoice item |
invoice_item_other | Invoice item string | string | Yes, if creating a custom invoice item |
qty | Invoice item quantity | number | Yes |
uom_id | Unique identifier for the Unit of Measure (UOM). See /bid/uom | number | No |
price | Invoice item price | number | Yes |
flat_fee | true if Flat Fee should be enabled; false otherwise | bool | No |
price_sub_adj | Contractor line item adjustment | number | No, only valid in contractor_items |
adj_comment | Comment for line item adjustment | string | No, only valid in contractor_items |
Example:
{
"report_id": 3850,
"contractor_items": [{
"invoice_item_id": 42921,
"qty": 1,
"uom_id": 1,
"price": 7.77,
"flat_fee": true
}],
"client_items": [{
"invoice_item_id": 42921,
"qty": 2,
"uom_id": 1,
"price": 9.88
}]
}
curl -H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{"report_id":3850,"contractor_items":[{"invoice_item_id":42921,"qty":1,"uom_id":1,"price":7.77,"flat_fee":true}],"client_items":[{"invoice_item_id":42921,"qty":2,"uom_id":1,"price":9.88}]}' \
https://ppw.web/svc/invoice/create
Response
| Field | Description | Type |
|---|---|---|
invoice_id | Unique identifier for the work order’s invoice | number |
Example successful response:
{
"invoice_id": 427
}
Errors
| Error Type | Description | Status Code |
|---|---|---|
access_denied | Access token is invalid or expired | 401 |
scope_invalid | Client app does not have the required OAuth scope | 403 |
wo_invalid | Work order is invalid | 400 |
invoice_exists | Invoice already exists | 400 |
invoice_item_id_not_allowed | invoice_item_id cannot be set | 400 |
invoice_item_id_required | invoice_item_id is required | 400 |
invoice_item_id_invalid | Invoice item is invalid | 400 |
qty_required | Quantity is not in the request | 400 |
qty_invalid | Quantity is invalid | 400 |
uom_invalid | Unit of Measure (UOM) is invalid | 400 |
uom_not_allowed | Unit of Measure (UOM) cannot be set | 400 |
price_required | Price is required | 400 |
price_invalid | Price is invalid | 400 |
flat_fee_invalid | Flat Fee is invalid | 400 |
invalid_fields | Some fields in the request are invalid | 400 |