Composite request submission example for Personal Auto

You can test your work by executing the following composite request. This is an end-to-end test that does the following:

  1. Creates a new account.
  2. Create a Personal Auto submission for the account.
  3. Answers the question "Is the applicant currently insured" with "No - New Driver" (newdriver).
  4. Adds a line-level optional coverage (PALossOfUseCov).
  5. Adds a vehicle.
  6. Adds an optional coverage (PARentalCov) to the vehicle, and specifies the 20 dollars/day for 60 days (60/20) coverage term.
  7. Specifies contact information that is required for quoting (such as date of birth and number of accidents).
  8. Specifies vehicle driver information (percent of time the contact driver the vehicle).
  9. Sets the Anti-Lock Breaks Discount modifier to true.
  10. Quotes the job.
{
  "requests": [
    {
      "method": "post",
      "uri": "/account/v1/accounts",
      "body": {
        "data": {
          "attributes": {
            "initialAccountHolder": {
              "contactSubtype": "Person",
              "firstName": "Tamsin",
              "lastName": "Tester",
              "primaryAddress": {
                "addressLine1": "2850 S. Delaware St.",
                "city": "San Mateo",
                "postalCode": "94403",
                "state": {
                  "code": "CA"
                }
              }
            },
            "initialPrimaryLocation": {
              "addressLine1": "2850 S. Delaware St.",
              "city": "San Mateo",
              "postalCode": "94403",
              "state": {
                "code": "CA"
              }
            },
            "producerCodes": [
              {
                "id": "pc:16"
              }
            ], 
            "organizationType": {
              "code": "other" 
            }
          }
        }
      },           
      "vars": [
        {
          "name": "accountId",
          "path": "$.data.attributes.id"
        },
        {
          "name": "driverId",
          "path": "$.data.attributes.accountHolder.id"
        }
      ]
    },
    {
      "method": "post",
      "uri": "/job/v1/submissions",
      "body": {
        "data": {
          "attributes": {
            "account": {
              "id": "${accountId}"
            },
            "baseState": {
              "code": "CA"
            },
            "jobEffectiveDate": "2022-08-01",
            "producerCode": {
              "id": "pc:16"
            },
            "product": {
              "id": "PersonalAuto"
            }
          }
        }
      },
      "vars": [
        {
          "name": "jobId",
          "path": "$.data.attributes.id"
        }
      ]
    },
    {
      "method": "patch",
      "uri": "/job/v1/jobs/${jobId}/questions",
      "body": {
        "data": {
          "attributes": {
            "answers": {
              "PACurrentlyInsured": {
                  "choiceValue": {
                    "code": "newdriver"
                  }
              }
            }
          }
        }
      }
    },
    {
      "method": "post",
      "uri": "/job/v1/jobs/${jobId}/lines/PersonalAutoLine/coverages",
      "body": {
        "data": {
          "attributes": {
            "pattern": {
              "id": "PALossOfUseCov"
            }
          }
        }
      }
    },
    {
      "method": "post",
      "uri": "/job/v1/jobs/${jobId}/lines/PersonalAutoLine/vehicles",
      "body": {
        "data": {
          "attributes": {
              "make": "Toyota",
              "model": "Tercel",
              "modelYear": 2010,
              "costNew": {
                  "amount": "33000",
                  "currency": "usd"
              },
              "licenseState": {
                  "code": "CA"
              },
              "vin": "14HEW8RLGMDSP03AA"
          }
        }
      },
      "vars": [
        {
          "name": "vehicleId",
          "path": "$.data.attributes.id"
        }
      ]
    },
    {
      "method": "post",
      "uri": "/job/v1/jobs/${jobId}/lines/PersonalAutoLine/vehicles/${vehicleId}/coverages",
      "body": {
        "data": {
          "attributes": {
            "pattern": {
              "id": "PARentalCov"
            },
            "terms": {
              "PARental": {
                "choiceValue": {
                  "code": "60/20"
                }
              }
            }
          }
        }
      }
    },
    {
      "method": "patch",
      "uri": "/job/v1/jobs/${jobId}/contacts/${driverId}",
      "body": {
        "data": {
          "attributes": {
              "dateOfBirth": "1980-10-10",
              "licenseNumber": "CA7732839",
              "licenseState": {
                  "code": "CA"
              },
              "numberOfAccidents": {
                  "code": "0"
              },
              "numberOfViolations": {
                  "code": "0"
              },
              "policyNumberOfAccidents": {
                  "code": "0"
              },
              "policyNumberOfViolations": {
                  "code": "0"
              }
          }
        }
      }
    },  
    {
      "method": "post",
      "uri": "/job/v1/jobs/${jobId}/lines/PersonalAutoLine/vehicles/${vehicleId}/drivers",
      "body": {
        "data": {
          "attributes": {
              "percentageDriven": 100,
              "policyDriver": {
                  "id": "${driverId}"
              }
          }
        }
      }
    },
    {
      "method": "patch",
      "uri": "/job/v1/jobs/${jobId}/lines/PersonalAutoLine/vehicles/${vehicleId}/modifiers/PAAntiLockBrakes",
      "body": {
        "data": {
          "attributes": {
            "booleanModifier": true
          }
        }
      }
    },
    {
      "method": "post",
      "uri": "/job/v1/jobs/${jobId}/quote"
    }
  ]
}