external_id on
every request and Pocketflows will create or update the record to match and
return the Pocketflows ID as well.
There are four sync endpoints:
POST /sync/businessesPOST /sync/businesses/batchPOST /sync/businesses/:business_id/customersPOST /sync/businesses/:business_id/customers/batch
Create or replace
All of the sync endpoints adopt a “create or replace” strategy. Whenexternal_id is provided in the API payload, if no existing record is found
with the external_id, a new record is created. When an existing record is
found, then its properties are wholly replaced by the new ones.
This also blanks out properties that are not provided in the request, so it is important to pass
all properties in every sync request.
id and external_id
The sync endpoints allow either external_id or id (the Pocketflows ID) to be
passed. id takes precedence over external_id and will be used to find the
record. When both id and external_id are passed, the record is first found
via the id then the external_id is updated to whatever is passed (along with
all other fields)
Batch requests
The customer batch endpoint allows for partial success: when a customer record is invalid for whatever reason, the rest of the request will process and create / replace the other records synced. The business batch endpoint does not: if any record is invalid, for example anid that does not match one of your businesses, the whole request fails and no
businesses are synced.
Related
- Sync businesses and customers for step-by-step requests.
- Migrate to the sync endpoints if you currently use the previous business and customer creation and update endpoints.