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.
curl POST --url 'https://{vanity_name}.api.visier.io/v1beta/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.
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 'Content-Type: application/zip' \
-d '@{sources_export_file_path}'
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 'Content-Type: application/zip' \
-H 'TargetTenantID: WFF_j1r~c7o'
-d '@{sources_export_file_path}'
The response returns a summary of the changes that were made by the API request.