This section shows you how to bulk-create a new set of property versions based on search results discussed in the Bulk searches section. You only need to bulk-version active properties, because you can't edit them once you activate them.
Launch a bulk versioning job
Once you have a set of search results, create a new bulk versioning object as in this example. Reflect each pair of propertyId
and propertyVersion
values from the search results
as propertyId
and createFromVersion
values within the array:
{
"createPropertyVersions": [
{
"propertyId": "prp_1",
"createFromVersion": 1
},
{
"propertyId": "prp_15",
"createFromVersion": 2
}
]
}
POST the object to this URL:
POST /papi/v1/bulk/property-version-creations
Just like the initial bulk search request, the bulk versioning request executes asynchronously, and its results are available in a separate GET operation. The link to the URL is available in the response's Location
header, or in the JSON response's bulkCreateVersionLink
. Store the value:
{
"bulkCreateVersionLink": "/papi/v1/bulk/property-version-creations/737"
}
Check bulk versioning status
Go ahead and GET the URL from the step above. The GET response reflects back all the originally requested set of createPropertyVersions
, but filled out with more data:
{
"bulkCreateId": 9,
"bulkCreateVersionsStatus": "IN_PROGRESS",
"bulkCreateVersionSubmitDate": "2018-01-18T00:00:00Z",
"bulkCreateVersionUpdateDate": null,
"createPropertyVersions": [
{
"propertyId": "prp_15",
"createFromVersion": 2,
"createFromVersionEtag": "343410c585cf67fc",
"propertyVersion": 3,
"createVersionStatus": "CREATING",
"propertyVersionLink": null,
"etag": null,
"createVersionSubmitDate": "2018-01-18T00:00:00Z",
"createVersionUpdateDate": null
},
{
"propertyId": "prp_3",
"createFromVersion": 10,
"createFromVersionEtag": "6c7v5c65c6cvcv65",
"propertyVersion": 11,
"createVersionsStatus": "CREATED",
"propertyVersionLink": "/papi/v1/properties/prp_3/versions/11?contractId=1-1TJZFW&groupId=15166",
"etag": "3333333c33cc333",
"createVersionSubmitDate": "2018-01-18T00:00:00Z",
"createVersionUpdateDate": "2018-01-18T00:00:00Z"
}
]
}
Just like the initial bulk search request, you may again need to wait for the entire bulk versioning job to complete. Check the top-level bulkCreateVersionsStatus
for a value of COMPLETE
. If it's not yet ready, run the operation again later.
For all newly created versions:
-
Map the original
createFromVersion
to the newly createdpropertyVersion
, for use in the subsequent bulk patch operation. Note that the version number isn't necessarily incremented. -
Optionally store the new version's
etag
value. Including this value in the subsequent bulk patch operation ensures that your update doesn't overwrite anyone else's changes. To avoid the issue, make sure to first inform anyone else who may modify the properties that you want to bulk update them.