Data pushing

🚧

Sync for Commerce: beta testing

Note that Sync for Commerce is in beta testing.

📘

Use our Swagger to follow this guide

All the endpoints mentioned in this guide are available in our Sync for Commerce Swagger. You can use it to try the API requests from this guide directly in your browser. Before you use Swagger, make sure to authenticate.

  1. After the merchant completes the data mapping configuration, push your merchant’s data to the data endpoint for the following data types:
POST /data/companies/{companyId}/sync/{dataType}
  1. From the response, identify the datasetId. You can use this property to check whether the data has been processed and mapped successfully.
  2. Check whether the data has been successfully processed by Codat by calling the Data endpoint:
GET /meta/companies/{companyId}/pull/history/{datasetId}
{
  "id": "6f87fad8-862b-4e6d-ab67-1c8d49ebb5ee",
  "companyId": "a00a94a8-9443-4f1d-b658-bfb19d74c6bf",
  "connectionId": "26f2029f-8027-4971-807d-7378d74323d8",
  "dataType": "commerce-transactions",
  "status": "Complete",
  "requested": "2022-03-21T20:43:46.6756749Z",
  "completed": "2022-03-21T20:43:54.4552982Z",
  "progress": 100,
  "isCompleted": true,
  "isErrored": false
}

The status within the response will correspond to a dataset status, you can find a list of available statuses here.

  1. (Optional) The data will be sent to the accounting platform at the time configured by the merchant. You can check whether the data has been mapped to the accounting platform successfully:
GET /meta/companies/{companyId}/sync/commerce/status

Rules for sending data

There are several things to keep in mind when pushing the data to Codat:

  • On the first push, POST the entire data set that you want to be synchronized into the accounting platform.
  • For all subsequent pushes, only push new or changed data. Ensure you record the latest data push to avoid overlap and duplication.
  • Only the data that you have sent to Codat’s API can be synced with the accounting package, so we strongly recommend pushing to Codat endpoints regularly throughout the day, and, in all cases, before a merchant’s configured sync time to ensure there is enough time for the data to be processed by Codat.
  • Do not make concurrent data calls for the same data types as they may get missed.
  • Whilst there are currently no rate limits or data limits, we would recommend payloads for Orders, Payments and Transactions are kept to under 5000 records.

Rules for updating data

When updating data, only send complete and changed objects. Even if just one field of an order has been changed, you should still send the whole object.

Don’t send the objects that haven’t been updated.

Rules for deleting data

To delete the data, send a sparse delete that only includes the object ID to signify that it is empty:

{
  "id": "01e63721-1205-478e-8503-9d8bf8a93f44"
}

Did this page help you?