get_pcr_json – Get PCR Form
The get_order event will return a work order and can contain a key named "pcr_forms". This key will contain an array of objects describing the forms assigned to the work order. The object will contain the following fields.
| Field Name | Type | Description |
|---|---|---|
pcr_form_id | number | The unique id of the form. |
form_id | string | The friendly Form ID from the PPW account the order being imported to. Only applicable when third party is creating orders. PPW will not send this. |
form_ver_id | number | The version of the form. |
form_required | number | If the form is required or not. 1 or 0 |
To retrieve the information for the form, use the get_pcr_json event.
Request payload JSON
{
"username": "demo",
"password": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
"site_id": "dcc363d0-8ed1-48a2-ba2e-f638275db4f",
"event_name": "get_pcr_json",
"event_data": "{\"pcr_form_id\":\"10066\",\"form_ver_id\":\"5\"}"
}
curl -X POST \
--data 'payload={
"username": "demo",
"password": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
"site_id": "dcc363d0-8ed1-48a2-ba2e-f638275db4f",
"event_name": "get_pcr_json",
"event_data": "{\"pcr_form_id\":\"10066\",\"form_ver_id\":\"5\"}"
}' \
https://www.propertypreswizard.com/api/link/receiver.php
The data returned will contain the full information about the PCR form. This includes some basic form info, questions, question answer options for single and multi selects, question rules, and photo rules.
The result_data field will contain an object with the key of the pcr_form_id that was requested. The options_pcr_forms field contains the basic info on the form. There are several fields that will not be useful but are provided for completeness.
Response JSON
{
"remote_site_id": "1fc25d06-72bd-42f8-ad34-ecbdc5f1a4a4",
"error": false,
"success": true,
"return_error_msg": null,
"result_data": {
"10066": {
"options_pcr_forms": {
"pcr_form_id": "10066",
"org_id": "18",
"pcr_form_name": "*** TEST SKIP LOGIC",
"default_required": "1",
"form_photos_required": "0",
"transfer_prev_values": "0",
"client_new_wo": "0",
"global_form": "0",
"web_template": "",
"fillable_pdf": "",
"pcr_form_active": "1",
"pruvan_ver": "0",
"thirdparty_id": "",
"form_deleted": "0",
"form_share_name": "_TEST_SKIP_LOGIC",
"pruvan_master_id": "",
"insert_by": "55",
"insert_date": "2017-03-21 09:21:27",
"publish_changes": "1",
"inspectorade_id": null,
"cyprexx_id": null,
"pruvan_id": null
}
}
}
}
| Field Name | Type/Length | Description |
|---|---|---|
pcr_form_id | number | The unique id of the form. |
org_id | number | The internal ID of the company in PPW. |
pcr_form_name | string | The name of the form. |
default_required | boolean | 1 or 0. If form is required by default on new orders. |
form_photos_required | boolean | No longer used. In photo rules information. |
transfer_prev_values | boolean | No longer used. In question information. |
form_share_name | string | Alphanumeric version of form name. |
PCR Questions
The questions object contains the following data. This should allow you to recreate the form on your own system and have the same options and functionality as PPW.
Response JSON Cont.
"options_pcr_forms_questions": {
"853007": {
"pcr_question_id": "853007",
"pcr_form_id": "10066",
"question_num": "",
"question_name": "Name",
"question_desc": "",
"question_type": "textbox",
"question_data_type": "varchar",
"question_display_active": "1",
"question_required": "1",
"question_na_option": "0",
"question_flag_photos": "0",
"question_photos_required": "0",
"question_active": "0",
"question_deleted": "1",
"question_form_length": "",
"question_order": "1.00",
"pdf_field_id": "0",
"thirdpartyfield_id": "0",
"question_share_name": "Name",
"question_transfer_prev_values": "0",
"question_show_prev_values": "0",
"question_auto_transfer_prev_values": "0",
"question_field_rules_cnt": "0",
"question_action_rules_cnt": "0",
"question_photo_rules_cnt": "0",
"insert_by": "55",
"insert_date": "2017-03-21 08:49:34"
},
"853116": {
"pcr_question_id": "853116",
"pcr_form_id": "10066",
"question_num": "",
"question_name": "Able to access property."
...
}
| Field Name | Type/Length | Description |
|---|---|---|
pcr_question_id | number | The unique id of the question. |
pcr_form_id | number | The form the question is associated with. |
question_num | string | No longer used. |
question_name | string | Question displayed to the end user. |
question_desc | string | Currently not used. |
question_type | string | The type of question. See below for descriptions. |
question_data_type | string | The data type as stored in database. |
question_display_active | boolean | Is the question shown by default. If not a rule may make it display active. |
question_required | boolean | Is the question required by default. Questions not shown are never required. |
question_na_option | boolean | No longer used. |
question_flag_photos | boolean | No longer used. Use photo rules. |
question_photos_required | boolean | No longer used. Use photo rules. |
question_active | boolean | Is question active. In-active questions will not be used or shown. |
question_deleted | boolean | If question is deleted. Deleted questions are no longer shown on form builder. |
question_form_length | string | Used for displaying a friendly field size on web. Does not affect PPW mobile app. |
question_order | number | The order of the questions. Ordered in ascending. |
pdf_field_id | string | Used for custom PDF fields. |
thirdpartyfield_id | string | NA |
question_share_name | string | Alphanumeric version of question. |
question_transfer_prev_values | boolean | Can the user copy previous form answers. |
question_show_prev_values | boolean | Is the previous answer displayed. |
question_auto_transfer_prev_values | boolean | Is the previous answer automatically filled in. |
*_rules_cnt | number | A total for each rule type. Helpful metadata. |
The PCR form question types are described below.
| Question Type | Description |
|---|---|
checkbox | Multiple options shown at once, multiple can be selected. |
date | A date is required. Normally calendar selector is shown. |
dropdown, radio | Multiple options shown, only one can be selected. |
numeric | A valid number must be entered. |
photos | Question only requires a photo. |
ppwfield | A field from the work order will be displayed instead of requiring an answer. |
textarea | Large comment area. |
textbox | A text input for the user. Limited to 255 characters. |
title | A heading or informational message will be shown. No answer required. |
The PCR form question data types are described below.
| Question Data Type | Description |
|---|---|
| number | An integer. Used for checkbox, dropdown, and radio. Stores the answer as the internal PPW id for the option. |
| number | A number but with decimals to 2 places. |
| string | Text limited to 255. |
| date | A valid date. |
| string | Long text field. |
PCR Question Options
Questions of type checkbox, dropdown and radio will all have options in the
options_pcr_forms_questions_values field. This field is an array of all the options for all questions. They are not ordered or grouped in a specific way. You can loop through all the items and associate them as needed.
Response JSON Cont.
"options_pcr_forms_questions_values": {
"1238051": {
"question_value_id": "1238051",
"pcr_question_id": "853116",
"question_value": "Yes",
"pdf_field_id": "0",
"question_value_active": "1",
"thirdparty_value_id": "0",
"question_share_value": null
},
"1238052": {
"question_value_id": "1238052",
"pcr_question_id": "853116",
"question_value": "No",
"pdf_field_id": "0",
"question_value_active": "1",
"thirdparty_value_id": "0",
"question_share_value": null
}
},
| Field Name | Description |
|---|---|
question_value_id | The unique ID of the question answer option. |
pcr_question_id | The pcr_question_id associated with the answer option. |
question_value | The user displayed value of the answer option. |
pdf_field_id | Used for custom PDF files. |
question_value_active | If answer option is active. In-active options are hidden from user. |
thirdparty_value_id | Not used. |
question_share_value | Not used. |
PCR Question Rules
The rules for questions have two options. There are filed rules and action rules. Field rules determine how a question should be answered. Ex. answer must be greater than 2 and less than 12. Or you must select at least 3 of the 10 options. Action rules determine what other questions should be shown or hidden based on a question answer.
Action rules will have additional information in a field called options_pcr_forms_rules_checks. This field will be described further in the documentation.
Response JSON Cont.
"options_pcr_forms_rules": {
"22993": {
"pcr_form_rule_id": "22993",
"pcr_form_id": "10066",
"pcr_question_id": "853116",
"rule_type": "action",
"rule_operator": "=",
"rule_value": "",
"insert_by": "55",
"insert_date": "2017-03-30 12:03:55"
},
"22994": {
"pcr_form_rule_id": "22994",
"pcr_form_id": "10066",
"pcr_question_id": "873273",
"rule_type": "action",
"rule_operator": "=",
"rule_value": "1236968",
"insert_by": "55",
"insert_date": "2017-03-29 23:32:19"
},
"24131": {
"pcr_form_rule_id": "24131",
"pcr_form_id": "10066",
"pcr_question_id": "877718",
"rule_type": "field",
"rule_operator": "length_greater_than",
"rule_value": "2",
"insert_by": "55",
"insert_date": "2017-04-08 09:04:49"
}
},
| Field Name | Description |
|---|---|
pcr_form_rule_id | The unique ID of the rule. |
pcr_form_id | The pcr_form_id associated with the rule. |
pcr_question_id | The pcr_question_id associated with the rule. |
rule_type | The type of rule. field or action. |
rule_operator | How the rule should be matched. |
rule_value | The value the rule matches. Could be a single value or a JSON array of multiple answers. Ex. [12345,12346,12347] |
The rule operator types are described below.
| Rule Operator | Description |
|---|---|
= | The answer is equal to the value(s) selected. This is an exact match. Multi select must match all items. |
not_equal | The answer is not equal to the rule_value. |
> | Greater than. Used for numeric/text fields. |
< | Less than. Used for numeric/text fields. |
contains_any | Multi select questions. If any selected values are matched, the rule applies. |
contains_all | Multi select questions. If ALL selected values are matched, the rule applies. |
doesnt_contain_any | Multi select questions. Opposite of contains_any. |
doesnt_contain_all | Multi select questions. Opposite of contains_all. |
count | Multi select questions. Number of items selected equals rule_value. |
count_less_than | Multi select questions. Number of items selected is less than rule_value. |
count_greater_than | Multi select questions. Number of items selected is greater than rule_value. |
length_greater_than | Textbox and textarea question types. Length of answer string is greater than rule_value. |
length_less_than | Textbox and textarea question types. Length of answer string is less than rule_value. |
length_equal | Textbox and textarea question types. Length of answer string equals rule_value. |
The field options_pcr_forms_rules_checks determines what action is taken when the rule is matched. The actions are either show or hide. The JSON and fields are described below.
Response JSON Cont.
"options_pcr_forms_rules_checks": {
"43819": {
"pcr_rule_check_id": "43819",
"pcr_form_rule_id": "22993",
"pcr_question_id": "873273",
"check_operator": "show",
"check_value": "",
"insert_by": "55",
"insert_date": "2017-03-21 08:48:46"
},
"43820": {
"pcr_rule_check_id": "43820",
"pcr_form_rule_id": "22994",
"pcr_question_id": "853121",
"check_operator": "show",
"check_value": "",
"insert_by": "55",
"insert_date": "2017-03-21 08:49:15"
},
"46739": {
"pcr_rule_check_id": "46739",
"pcr_form_rule_id": "24132",
"pcr_question_id": "853121",
"check_operator": "show",
"check_value": "",
"insert_by": "55",
"insert_date": "2017-04-08 15:07:56"
}
},
| Field Name | Description |
|---|---|
pcr_rule_check_id | The unique ID of the rule check. |
pcr_form_rule_id | The pcr_form_rule_id associated with this rule check. |
pcr_question_id | The pcr_question_id the action is taken on. |
check_operator | The rule check action. Either show or hide. |
check_value | No longer used. |
Photo rules for the form are contained in the field options_pcr_forms_photo_rules. Photo rules have a similar structure as the question field and action rules. Every question has a default photo rule. Photo rules have a min and max for the photo requirements. If a rule has a min set to zero, then photos are not required for the question. If the max is also set to zero, then photos can not be taken for the question. If the min is greater than 0.
Response JSON Cont.
"options_pcr_forms_photo_rules": {
"24765": {
"pcr_photo_rule_id": "24765",
"pcr_question_id": "853007",
"rule_operator": "default",
"rule_value": "default",
"take_photo": "0",
"require_photo": "0",
"min_photo": "0",
"max_photo": "20",
"insert_by": "55",
"insert_date": "2017-03-21 08:49:34"
},
"59201": {
"pcr_photo_rule_id": "59201",
"pcr_question_id": "877718",
"rule_operator": "=",
"rule_value": "red",
"take_photo": "0",
"require_photo": "0",
"min_photo": "5",
"max_photo": "10",
"insert_by": "55",
"insert_date": "2017-04-08 09:25:08"
},
"59203": {
"pcr_photo_rule_id": "59203",
"pcr_question_id": "877718",
"rule_operator": "default",
"rule_value": "default",
"take_photo": "0",
"require_photo": "0",
"min_photo": "1",
"max_photo": "5",
"insert_by": "55",
"insert_date": "2017-04-08 09:25:08"
}
}
| Field Name | Description |
|---|---|
pcr_photo_rule_id | The unique ID of the photo rule. |
pcr_question_id | The pcr_question_id the photo rule is associated with. |
rule_operator | How the rule should be matched. |
rule_value | The value the rule matches. Could be a single value or a JSON array of multiple answers. Ex. [12345,12346,12347] |
take_photo | No longer used. |
require_photo | No longer used. |
min_photo | Minimum photo requirements for rule. |
max_photo | Maximum photo requirements for rule. |