external_id
on every request and Pocketflows will create or update the record to match and return the Pocketflows ID as well.
All of these new endpoints adopt a “create or replace” strategy. When external_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.
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 endpoints allow for partial success: when a business / customer record is invalid for whatever reason, the rest of the request will process and create / replace the other records synced.
POST /businesses
POST /businesses/:id
POST /businesses/:id/customers
POST /businesses/:id/customers/batch
POST /businesses/:id/customers/batch_update
POST /customers/:id
POST /sync/businesses
(for single updates / creates) and POST /sync/businesses/batch
(to update multiple businesses at once, previously not possible!). Crucially, pass both id
and external_id
so that Pocketflows can associate the existing id
with the new external_id
POST /sync/businesses/:id/customers
(for updating or creating a single customer) or POST /sync/businesses/:id/customers/batch
(for updating all the customers of a business). Again, be sure to pass both id
and external_id
so that we can associate the IDs together.external_id
associated, you can stop sending id
as part of the payload.