Skip to main content

Copy Configurations

This API allows you to make one or multiple copies of a consent configuration previously created on the Osano Admin Application for use across multiple web properties

See Consent Manager API - Setup for setup instructions.

Contents

API

Prior to using this API, be sure to create a template consent manager configuration within the Osano Web Application. See the CMP Setup Guide for instructions. Once the Consent Manager is configured to your liking, use the "Get Code" button to obtain your Osano.js.

Your osano.js will contain your Customer ID and your Configuration ID:

https://cmp.osano.com/CustomerID/ConfigurationID/osano.js

Note: The Copy Configuration API currently creates a full copy of the template configuration. The following will be copied over to the new configuration(s):

  • Settings
  • Domains
  • Styling
  • Script and Cookie Rules

The "Name" of your newly copied configurations will appear as "configName-Copy" in the Osano Application until edited.

This API supports the following GraphQL queries:

  • copyConfig: creates a single copy of a configuration
  • copyNConfigs: creates multiple copies of a configuration (up to 25 maximum in one call)

Note: an optional webhook URL can be provided and will be called when the operation is complete

copyConfig

Create a single copy of a consent manager configuration.

Arguments

  • configId: ID of the configuration to copy
  • [webhookURL] optional: A URL to be called when the operation is complete

Example Query Body

Replace the configId value with your appropriate ID:

query {
copyConfig(
configId: "YOUR CONFIG ID VALUE HERE"
# webhookURL is optional
webhookURL: "https://example.com/webhook/copycomplete"
) {
... on Config {
configId
}
}
}

Example Success Response

{
"data": {
"copyConfig": {
"configId": "22296d5f-86f3-4f7c-b221-cc119715459d"
}
}
}

Example Error Response

{
"errors": [
{
"message": "The configuration for a8d11a01-1a4a-47a3-8781-97b1a0342bd1 was not found; please check the config id again. It may have been deleted prior to this operation.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": ["copyConfig"],
"extensions": {
"code": "DATABASE_ERROR"
}
}
],
"data": null
}

copyNConfigs

Creates multiple copies of a consent manager configuration (up to a maximum of 25 at once).

Arguments

  • configId: ID of the configuration to copy
  • numRequests: The number of copies to make
  • [webhookURL] optional: A URL to be called when the operation is complete

Example Query Body

Replace the configId value with your appropriate ID:

query {
copyNConfigs(
configId: "YOUR CONFIG ID VALUE HERE"
numRequests: 2
# webhookURL is optional
webhookURL: "https://example.com/webhook/copycomplete"
) {
... on Configs {
configIds
errorCount
}
}
}

Example Success Response

{
"data": {
"copyNConfigs": {
"configIds": [
"d8eb38cd-e47f-4d06-ba28-6c10df42632c",
"f9352d23-ea44-445b-8e1c-4a7830a2b532"
],
"errorCount": 0
}
}
}

Example Partial Success Response

{
"data": {
"copyNConfigs": {
"configIds": [
"d8eb38cd-e47f-4d06-ba28-6c10df42632c"
],
# numRequests was 2. One failed and the ID of the success is above.
"errorCount": 1
}
}
}

Example Error Response

{
"errors": [
{
"message": "Invalid number of requests",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": ["copyNConfigs"],
"extensions": {
"code": "FORBIDDEN"
}
}
],
"data": null
}