Learn how to migrate from the (legacy) CSV Import API to the (new) CSV Import API.
Staffbase offers a new CSV Import API that simplifies and streamlines the process of importing user data. This new API offers significant improvements compared to the previous (legacy) CSV Import API.
This article explains the difference between the legacy CSV Import API and the new CSV Import API workflows and endpoints. Understanding these differences will allow you to migrate to the new API and take full advantage of its benefits. For getting started with the CSV Import API, see (New) Get Started With a CSV Import.
It is also important to note that the legacy method is planned to be deprecated in the future. Therefore, Staffbase recommends you transition to the new method at your earliest convenience.
This article covers only the endpoints for the main processes. It does not include example requests and responses for the endpoints for the main processes. If you want to learn more about examples or other endpoints not covered in the article, refer to the respective API specifications:
The workflow for both CSV import methods remains relatively the same, but the endpoints and functionalities differ providing more flexibility.
POST
request to /users/imports/
.PATCH
request to /users/imports/{importId}/config/
.PATCH
request to /users/imports/{importId}
with state parameter set to PREVIEW_PENDING
.PATCH
request to /users/imports/{importId}
with state set to IMPORT_PENDING
in the request body.POST
request to /users/import/csv/upload
.POST
request to /users/import/csv/update
with dry=true
.POST
request to /users/import/csv/update
with dry=false
.The main differences between the endpoints are:
With the (new) CSV Import API, you can upload:
With the (legacy) Import API, you can upload:
If you want to upload another file, either the current upload must be canceled or completed.
POST
request to /users/imports/
In this method, you only specify the local path of your CSV file.
POST
request to /users/import/csv/upload
In this method, you need to specify the local path of your CSV file and the initial configuration, which includes:
The (new) import does not support the partial import function. Instead, it has an advanced feature called delta import, which covers the same use case as partial import. Learn more.
PATCH
request to /users/imports/{importId}/config/
In this method, you need to specify the general configuration and mapping.
Under general configuration, you can define:
Parameter | Description |
---|---|
reportMailAddress | The parameter to add a recipient email address for the processed CVS import report. |
reportOnlyErrors | The parameter that defines if an email only needs to be sent to the reportMailAddress recipient if an error occurs. |
POST
request to /users/import/csv/update
With endpoint, you can specify the mapping and define the following:
generateRecoveryCodes
sendMailsNew
sendMailsPending
invitationLanguage
dryRun
PATCH
request to the endpoint /users/imports/{importId}
, with state parameter set to PREVIEW_PENDING
This is an additional step in the process for previewing the import, which makes the process more reliable than the legacy import method.
POST
request to the /users/import/csv/update
with dryRun
parameter set to true
.
PATCH
request to /users/imports/{importId}
, with state
parameter set to IMPORT_PENDING
.
POST
request to /users/import/csv/update
, with dry
parameter set to false
.
Now that you know the differences between the import methods, you can transition to the (new) CSV Import.