Sources API Code Samples

Selection of code samples that demonstrate the use of the Sources API. Copy and edit these code samples to suit your needs.

When using the code samples, remember to replace:

  • {vanity_name} with your tenant name
  • {api_key} with your API key
  • {security_token} with a valid security token

These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Sources" in API Reference.

Export all sources

Use this sample to export a ZIP file that contains a list of all sources in your tenant.

Copy
cURL sample request: Export all sources from tenant WFF_j1r~c7o
curl POST --url 'https://{vanity_name}.api.visier.io/v1beta/admin/sources' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID: WFF_j1r~c7o' \
-H 'Content-Type: application/json' \
-H 'Accept: application/zip, application/json' \
-d '{
    "operation": "exportSources"
}'

The response returns a ZIP file containing all sources in the tenant.

Import a ZIP file that contains a list of sources

Use this sample to export a ZIP file that contains a list of all sources in your tenant. In this example, replaceAllExistingSources is true, meaning that the imported list of sources will replace all the sources in the target tenant.

Copy
cURL sample request: Import a list of sources to tenant WFF_j1r~c7o
curl --location --request PUT 'https://{vanity_name}.api.visier.io/v1beta/admin/sources?replaceAllExistingSources=true' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID: WFF_j1r~c7o' \
-H 'Content-Type: application/zip' \
-d '@{sources_export_file_path}'

The response returns a summary of the changes that were made by the API request.

Copy
Sample response
{
    "summary": {
      "updated": 3,
      "created": 1,
      "deleted": 1
    }
}

Clone source files

Use this sample to clone a source's files into a different source.

Copy
cURL sample request: Clone source files from Original source into target source New for tenant WFF_j1r~c7o
curl POST --url 'https://{vanity_name}.api.visier.io/v1beta/admin/sources' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o' \
-H 'Content-Type: application/json' \
-d '{
    "operation": "cloneFilesIntoSource",
    "cloneFilesIntoSourceParameters": {
        "originSource": "Original",
        "targetSource": "New",
        "dateRange": {
            "start": "2024-01-01"
            "end": "2024-12-31"
        }
    }
}'

If successful, the response returns a job ID. Use the job ID to monitor the cloning results.

Copy
Sample response
{
    "jobId": "631a16e2-dc7a-4b10-a780-d53b78c2dd28"
}