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
curl POST --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/sources' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-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
curl --location --request PUT 'https://{vanity_name}.api.visier.io/v1alpha/admin/sources?replaceAllExistingSources=true' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-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
    }
}