Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation.

Export data from a collection to a file

Submit a job to export selected products from a Wix data collection to a CSV file:

  1. Call Submit Job with the following parameters:

    Copy

    The method returns a response such as:

    Copy
  2. To check the job's status, call the Get Job method with the job's id.

    The method returns a response such as:

    Copy

    A job is completed when its status updates to COMPLETED or PARTIALLY_SUCCESSFUL.

    Note: To respond in real time when a job's status is updated, you can subscribe to the Job Updated webhook. Learn more about webhooks.

  3. When the job completes, download the file from the URL in the response's destination.file.url property.

  4. To know more about the job's results, view the job's logs by calling List Movement Jobs.

    The method returns a response such as:

    Copy

Import data from a file to a collection

Submit a job to import products from a CSV file into a Wix data collection. If a product already exists in the destination collection, the job skips it:

  1. Call Create File Upload Url to generate a file upload URL.

    The method returns a response such as:

    Copy

    Save fileId and uploadUrl for later use.

  2. Upload the source file to the uploadUrl you saved in the previous step. For example:

    Copy

    Note: The upload URL is valid for 15 minutes.

  3. Call Submit Job with the following parameters. In the request's source.file.fileId property, specify the fileId you saved earlier:

    Copy

    The method returns a response such as:

    Copy

    Wix Data now begins importing the data from the file into the specified collection.

  4. To check the job's status, call the Get Job method with the job's id.

    The method returns a response such as:

    Copy

    A job is completed when its status updates to COMPLETED or PARTIALLY_SUCCESSFUL.

    Note: To respond in real time when a job's status is updated, you can subscribe to the Job Updated webhook. Learn more about webhooks.

When the job completes, you can access the imported items in the CMS and with Wix Data APIs.

Export, edit, and import localized CMS content

Submit a job to export localized CMS content to a CSV file. After editing its content, import it back to the site:

  1. Call Submit Job with the following parameters:

    Copy

    The method returns a response such as:

    Copy
  2. To check the job's status, call Get Job with the job's id:

    The method returns a response such as:

    Copy

    A job is completed when its status updates to COMPLETED or PARTIALLY_SUCCESSFUL

    Note: To respond in real time when a job's status is updated, you can subscribe to the Job Updated webhook. Learn more about webhooks.

  3. Download the file from the URL in the response's destination.file.url property and edit its content.

  4. Call Create File Upload Url to generate a file upload URL:

    Copy

    The method returns a response such as:

    Copy

    Save fileId and uploadUrl for later use.

  5. Upload the edited file to the uploadUrl you saved in the previous step. For example:

    Copy

    Note: The upload URL is valid for 15 minutes.

  6. Call Submit Job again to import the edited product translations back into the site's CMS. In the request's source.file.fileId, specify the fileId you saved earlier. In the request's destination.localization.languages array, specify the languages you want to import:

    Note: The first language in the destination.localization.languages array is considered the main CMS language.

    Copy

    The method returns a response such as:

    Copy

    A job is completed when its status is updated to COMPLETED or PARTIALLY_SUCCESSFUL.

    Note: To respond in real time when a job's status is updated, you can subscribe to the Job Updated webhook. Learn more about webhooks.

    When the job completes, you can access the imported items using:

Did this help?