getVendorPurposeMapping command
Sourcepoint has extended the functionality of the IAB's TCF v2 API to offer your organization additional commands that can be used with the __tcfapi() function call. This additional functionality provides a level of consistency and feature overlap between IAB TCFv2 API and custom function integrations.
The getVendorPurposeMapping enables your organization to retrieve a list of vendors and map their purposes and legal bases for a specific property.
Use Case: Quickly identify which vendors are using a specific purpose in order to perform bulk operations such as __tcfapi postCustomConsent.

getVendorPurposeMapping command

The command returns a JSON object that contains information on the purposes and corresponding legal basis attributed to each vendor and their legal basis. The format of the getVendorPurposeMapping command is as follows:
Browser console command
Code example
Server-side script (PHP example)
1
//Input into browser console to receive response
2
__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });
Copied!
1
function callback_fn(gvl, success) {
2
// your custom callback code can be included here
3
console.log(gvl, success)
4
}
5
6
// call the __tcfapi() function with callback only
7
__tcfapi('getVendorPurposeMapping', 2, callback_fn);
Copied!
Your organization could use a server side script using code similar to the following PHP example to retrieve the vendor purpose mapping. You will need to provide the correct values for site id in the script.
1
$site_id = "XXXXX";
2
$api_endpoint = "https://sourcepoint.mgr.consensu.org/tcfv2/vendor-list/vendor-purpose-mapping?siteId=".$site_id;
3
$handle = curl_init($api_endpoint);
4
$fileHandle = fopen("vendor_purpose_mapping.json", "w");
5
6
/* If you encounter an 'SSL certificate problem: unable to get local issuer certificate' then enable the following two lines */
7
/* This is NOT recommended as a solution and should only be used as a quick and temporary fix */
8
//curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
9
//curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
10
11
curl_setopt($handle, CURLOPT_FILE, $fileHandle);
12
13
curl_exec($handle);
14
15
curl_close($handle);
16
fclose($fileHandle);
Copied!

getVendorPurposeMapping response

The response contains the consent data that maps the purposes and legal basis to the vendor. This is described next.
Vendor mapping
The categories section lists the purpose ids for each vendor with their legal basis type. The purposes are listed as follows:
Parameter
Description
_id
Purpose ID
type
The legal basis set for this purpose - consent, legitimate interest, not allowed, disclosure only
vendorId
Vendor ID
1
0:
2
categories:
3
0: {_id: "6011ea75c5d9c787531b3ecf", type: "CONSENT"}
4
1: {_id: "6011ea75c5d9c787531b3ed6", type: "CONSENT"}
5
2: {_id: "6011ea75c5d9c787531b3ede", type: "CONSENT"}
6
3: {_id: "6011ea75c5d9c787531b3ee6", type: "CONSENT"}
7
4: {_id: "6011ea75c5d9c787531b3eed", type: "CONSENT"}
8
5: {_id: "6011ea75c5d9c787531b3ef5", type: "CONSENT"}
9
6: {_id: "6011ea75c5d9c787531b3efd", type: "DISCLOSURE_ONLY"}
10
7: {_id: "6011ea75c5d9c787531b3f05", type: "CONSENT"}
11
8: {_id: "6011ea75c5d9c787531b3f0e", type: "CONSENT"}
12
9: {_id: "6011ea75c5d9c787531b3f18", type: "LEGITIMATE_INTEREST"}
13
vendorId: "5e7ced57b8e05c47e418b73c"
14
1:
15
categories:
16
0: {_id: "6011ea75c5d9c787531b3ecf", type: "NOT_ALLOWED"}
17
1: {_id: "6011ea75c5d9c787531b3ed6", type: "NOT_ALLOWED"}
18
3: {_id: "6011ea75c5d9c787531b3efd", type: "CONSENT"}
19
3: {_id: "6011ea75c5d9c787531b3f05", type: "CONSENT"}
20
vendorId: "5e37fc3e56a5e6614776722f"
Copied!
Last modified 2mo ago