Click JSON above the Template Editor to select this format type.
In theory, if a buyer specification contains a sample request to the buyer API, you can copy it to the Template Editor to simplify mapping process. However, in practice, sample requests in specifications rarely contain all the necessary fields. So it is recommended to map all the fields manually.
In JSON, all mapping is performed inside curly brackets (unless otherwise indicated in buyer specification):
Map all the fields using instructions below for our Example Buyer Specification.
XML and JSON Template Editors include a convenient tool for code validation – hotkey CTRL+SHIFT+F. Use it to keep your code structured and readable. You can also use the JSON Validator to check your code for mistakes.
1. lead_type - determines the type of lead. MUST be '5' for Auto Insurance.
If there is no field on PX side for mandatory mapping you can hardcode some value agreed with the buyer for this particular case. To execute hardcoding in JSON, enter the necessary value after the colon.
Put “ and a closing quote, colon, and comma will appear:
Enter the field name ‘lead_type’ inside the quotes and put ‘5’ between colon and comma to hardcode this field:
Unless otherwise indicated in buyer specification, all values in JSON Template Editor, except for numeric and boolean (true and false) fields, must be put in quotes. In addition, a comma must be put after each value except the last value inside curly brackets.
2. lead_mode is hardcoded similarly to the previous field:
The fields 3-5 (email, address, email, and address) in our specification contain contact data of the lead, which is not included in ping request and will be added only on the post parameters.
6. tcpa_text contains the TCPA message that is shown to consumers on the form where their information is submitted.
Put “tcpa_text”: and put <% inside the quotes to open the list of PX fields for corresponding vertical (Auto in our case). Start typing the field name to find the most appropriate PX field and click it for selection.
On the Mapping Panel, select URL encoding in the Encoding Type dropdown menu. Read more about Field Encoding.
The tcpa_text parameter displays a text message shown to the end-user when submitting the form. Open the PX specification for Auto Vertical and find the following TCPA message:
By clicking Get My Quotes, I authorize security companies, their dealers and partner companies to contact me about security offers by phone calls and text messages to the number I provided. I authorize that these marketing communications may be delivered to me using an automatic telephone dialing system or by prerecorded message. I understand that my consent is not a condition of purchase.
Copy and paste this text to Custom Value For Non Collected Leads field:
7. origination_datetime - Date/time when lead was submitted by consumer, in format 'YYYY-MM-DD hh:mm:ss', e.g. '2017-03-16 07:16:51'.
Enter an origination_datetime parameter and select the appropriate PX field (Lead Creation Date):
The date format in the specification is YYYY-MM-DD, which is different from PX default formatting. Enter the necessary format to Custom Date Format field on the Mapping Panel:
Read more about custom date formatting.
8. phone_last_4 - Last 4 digits of primary_phone. Required by some buyers on ping.
Map the field according to instructions in 7th point:
On the Mapping Panel, enter the necessary format to Custom Phone Format field.
Read more about custom phone formatting.
9. residence_type - Primary applicant’s residence status. 0 = Own, 1 = Rent.
Map the field according to instructions in 7th point:
Then map the field’s options using Mapping Panel.
1) Click On for Answer Values:
2) Map data formats by entering appropriate values from buyer specification to PX fields:
10. haveInsurance - Indicates whether driver1 has a current auto insurance policy or not. May include auto insurance policies that have expired no more than 30 days in the past. 0=No, 1=Yes.
When there is a condition in the field options, such fields should be mapped using Perform Check functionality. Use instructions in the document to map haveInsurance field properly in the Template Editor and on Mapping Panel:
According to these configurations, PX system will check whether the driver from the lead is insured or not and assign appropriate values (0 or 1), which are accepted by buyer.
The fields 11-14 in the specification (insuranceCompany, current_policy_start_date, current_policy_expiration_date, continuously_insured_period) are required only if haveInsurance=1(Yes). In this case, Perform Check should be used as well, so that PX system first checks haveInsurance field, and then decides whether to use next four fields or not.
Map all the fields and their options that are required if the haveInsurance=1 inside the PerformCheck tag, using instructions:
Use PerformCheck tags only inside the value because each parameter should be specified only once in JSON Template Editor.
13. current_policy_expiration_date - driver1's current policy expiration date, in the format YYYY-MM-DD. A date no more than 30 days in the past, the current date, or a future date.
Map this field according to instructions in the 7th point and enter 0 years and 01 months in Default Value field:
Read more about date shifting.
The fields 15 and 16 (driver1_firstname and driver1_lastname) in our specification contain contact data of the lead, which is not included in ping request and will be added only on the post.
The fields 17-19 are driver1_gender, driver1_dob, and driver1_maritalStatus.
There can be many drivers in a lead in Auto vertical that have the same fields in buyer specifications with different indexes (driver1, driver2, etc). For this purpose, API Builder has Field Cloning and Indexing features.
In JSON, Indexing is configured only for ID field, which is placed before all fields that should be indexed. In this case, the system will show Index 1 and a set of fields for it, Index 2 and a set of fields for it, etc.
In our example, only driver_id parameter will be indexed.
To clone fields with different indexing, follow these instructions:
1. Put drivers parameter and open curly brackets.
2. Put Each Driver Start and Each Driver End tags inside curly brackets:
3. Put driver_id parameter using Indexing tag:
4. Map all the fields and their options that are required for drivers between Start and End tags, after driver_id parameter:
Fields 20-22 (vehicle1_year, vehicle1_make, vehicle1_vin) are mapped similarly to driver fields, using Cloning tags and indexed vehicle_id parameter:
22. Let's take a closer look at the mapping of the vehicle1_vin field - the Vehicle Identification Number, e.g. '1ACBC535*B*******'.
On the Mapping Panel, enter the necessary format into Custom VIN Format field.
Read more about Custom VIN Formatting.
Here is what Map Your Ping API Fields & Inputs block with JSON formatting looks like when all fields from the buyer specifications have been mapped:
It is recommended to click Save at the bottom of Step 2 - Map API Inputs periodically to save your mappings.
As soon as you are done, click Save and Continue to save your mappings and proceed with the next step.
As soon as all fields are mapped for ping request, it is recommended to go to Step 3 and then to Step 4 in order to make all possible testing, and only after that proceed with mapping Fields & Inputs for Post request. This flow allows avoiding random lead sales because of sending Post request to the buyer.
Please sign in to leave a comment.