Import-Export

Get Redirect Import-Export Jobs

GET /storefront/redirects/imex/jobs

Request

Returns a collection of the storeʼs 301 redirects across all sites.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • id in query - string
    Filters results by redirect import-export job ID.
  • type in query - string
    Filters results by the type of the redirect import-export job.

    Allowed: import | export

  • status in query - string
    Filters results by the status of the Redirect Import-Export job.

    Allowed: new | working | complete | aborted | failed

  • limit in query with default of 10 - integer
    Determines the number of items returned per page. The default is 10 items per page.
  • page in query - integer
    Specifies the page number to return when the number of items returned exceeds the page limit. Used to paginate large collections.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects/imex/jobs' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Body

object | application/json
  • data
    array[object]

  • meta
    object

example

{
"data": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "import",
"status": "new",
"completed_items": 0,
"failed_items": 0,
"total_items": 0,
"errors": [
{
"row": 0,
"message": "string"
}
],
"created_at": "2022-01-04T04:15:50.000Z",
"completed_at": "2022-01-04T04:15:50.000Z"
}
],
"meta": {
"pagination": {
"total": 246,
"count": 5,
"per_page": 5,
"current_page": 1,
"total_pages": 50,
"links": {
"next": "?limit=5&page=2",
"current": "?limit=5&page=1"

Create Redirects Export Job

POST /storefront/redirects/imex/export

Request

Creates a new 301 Redirects export job.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • Content-Type in header with default of application/json - string
    required
    The MIME type of the request body.

Body

object | application/json
Data necessary to create a new 301 Redirects export job.
  • site_id
    integer or null

    The site ID for which you wish to export redirects. If no site ID is provided, the request exports all redirects for all sites.

    Default: null

  • redirect_ids
    array[integer]

    A list of the redirect IDs you wish to export. If no redirect IDs are provided, the request exports all redirects for the given site selection.

    Default: []

  • include_dynamic_target_urls
    boolean

    If true, the exported CSV will contain an additional read-only column containing the target URL for dynamic redirects.

    Default: false

example

{
"site_id": null,
"redirect_ids": [],
"include_dynamic_target_urls": false
}

Response

Created

Body

object | application/json
  • id
    string

    Example: ab1c2de3-f4gh-5678-i90j-klm12n345o67

example

{
"id": "ab1c2de3-f4gh-5678-i90j-klm12n345o67"
}

Create Redirects Import Job

POST /storefront/redirects/imex/import

Request

Creates a new 301 Redirects import job.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • Content-Type in header with default of multipart/form-data - string
    required
    The MIME type of the request body.

Body

object | multipart/form-data
Data necessary to create a new 301 Redirects import job.
  • import_file
    string
    required

    A CSV file containing a list of Redirects to be imported.

    The headers must be defined as follows:

    Domain,Old Path,Manual URL/Path,Dynamic Target Type,Dynamic Target ID

    Not every line will have a value for every column.

    Example: Domain,Old Path,Manual URL/Path,Dynamic Target Type,Dynamic Target ID store.example.com,/old-path,/new-manual-path,, store.example.com,/old-product,,Product,12 store.example.com,/old-brand,,Brand,34 store.example.com,/old-category,,Category,56 store.example.com,/old-page,,Page,78 store.example.com,/old-post,,Post,90

Response

Created

Body

object | application/json
  • id
    string

    Example: ab1c2de3-f4gh-5678-i90j-klm12n345o67

example

{
"id": "ab1c2de3-f4gh-5678-i90j-klm12n345o67"
}

Open Redirect Export Event Stream

GET /storefront/redirects/imex/export/{uuid}/events

Request

Opens an event stream to receive live updates from an export job.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of text/event-stream - string
    required
    The MIME type of the response body.
  • uuid in path - string
    required
    The import-export job identifier.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects/imex/export/[uuid]/events' \
--header 'Accept: text/event-stream' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Stream of export events. The data attribute is stringified JSON.

Body

string | text/event-stream
Example: event: message\ndata: {"job_id":"cfccdd6e-956e-4484-8cc2-a610db26bad9","status":"complete","completed_items":100,"total_items":100}\n\n

Open Redirect Import Event Stream

GET /storefront/redirects/imex/import/{uuid}/events

Request

Opens an event stream to receive live updates from an import job.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of text/event-stream - string
    required
    The MIME type of the response body.
  • uuid in path - string
    required
    The import-export job identifier.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects/imex/import/[uuid]/events' \
--header 'Accept: text/event-stream' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Stream of import events. The data attribute is stringified JSON.

Body

string | text/event-stream
Example: event: message\ndata: {{"job_id":"a4abaf59-9c25-4f37-a09d-66e6054229a1","status":"complete","completed_items":100,"failed_items":100,"total_items":93,"errors":[]}\n\n

Download Redirect Export

GET /storefront/redirects/imex/export/{uuid}/download

Request

Downloads the CSV file containing the results of an export job.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Content-Type in header with default of text/csv - string
    required
    The MIME type of the request body.
  • uuid in path - string
    required
    The import-export job identifier.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects/imex/export/[uuid]/download' \
--header 'Content-Type: text/csv' \
--header 'X-Auth-Token: {{token}}'

Response

The exported Redirects in CSV format
Did you find what you were looking for?