/workorder/create
This action creates a new work order for a property.
Request
| Field | Description | Required |
|---|---|---|
values | Work order field values | Yes |
The values field must be a JSON object. The keys in this object must
be a canonical work order field name. The value in this object depends
on the type of the work order field and should be set as follows:
| Work Order Field Type | Valid values(s) |
|---|---|
text | Text value |
date | Date value. Accepted formats: MM/DD/YYYY, YYYY-MM-DD, YYYYMMDD |
dropdown | Canonical value from the options in the fields.CANONICAL_WO_FIELD object returned by /workorder/fields |
array | An array of values. The work_items work order field have this type. |
The following fields are always required in values:
| Required Fields | Description | Type |
|---|---|---|
| address | Street name | string |
| city | City | string |
| state | US State Identifier (use /workorder/fields) | number |
| zip | Zipcode | string |
| work_type | Work Type Identifier (use /workorder/fields) | number |
| client_company | Client Company Identifier (use /workorder/fields) | number |
| date_due | Work Order Date Due | string |
The work_items work order field must be an array and each item in
this array must be a JSON object with the following parameters:
| Work Item Fields | Description | Type | Required |
|---|---|---|---|
id | Unique identifier for the invoice line item | number | Yes, if creating a invoice line item |
item_other | Custom line item string | string | Yes, if creating a custom line item |
qty | Item quantity | number | Yes |
price | Item price | number | Yes, if creating a custom line item |
instructions | Item instructions | string | No |
If price is not provided for a invoice line item, it will be auto
populated based on the invoice item pricing rules.
Example:
{
"values": {
"wo_number": "B847293838",
"address": "16168 MAIN MARKET RD",
"city": "BURTON",
"state": 35,
"zip": "44021",
"work_type": 28813,
"client_company": 12344,
"date_due": "01/15/2021",
"work_items": [{
"id": 42931,
"qty": 2,
"price": 30,
"instructions": "Some grass instructions"
}, {
"id": 42928,
"qty": 3,
"price": 10
}]
}
}
curl -H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{"values":{"wo_number":"B847293838","address":"16168 MAIN MARKET RD","city":"BURTON","state":35,"zip":"44021","work_type":28813,"client_company":12344,"date_due":"01/15/2021","work_items":[{"id":42931,"qty":2,"price":30,"instructions":"Some grass instructions"},{"id":42928,"qty":3,"price":10}]}}' \
https://ppw.web/svc/workorder/create
Response
| Field | Description | Type |
|---|---|---|
report_id | Unique identifier for the new work order | number |
org_property_id | Unique property identifier | number |
Example successful response:
{
"report_id": 10640,
"org_property_id": 217
}
Errors
| Error Type | Description | Status |
|---|---|---|
values_required | values parameter is invalid or not specified | 400 |
field_required | A required work order field is not specified in values | 400 |
invalid_field | A work order field specified in values is invalid | 400 |
invalid_date | The value of a date work order field in values is invalid | 400 |
invalid_option | The value of a dropdown work order field in values is invalid | 400 |
invalid_work_items | The one or more items in work_items is invalid | 400 |
duplicate | A work order with the specified wo_number already exists | 400 |
stop_work | Stop work is set for the property. Cannot create work order. | 400 |
freq_controls | Frequency control error | 400 |