API Reference

getVendorPurposeMapping

Returns mapping of vendors and purposes with legal bases on the vendor list associated with the property.

📘

For each vendor, the response will only include purposes that have a configured legal basis (Consent, Legitimate Interest, Disclosure Only). Any purposes that are Not Applicable will not be returned in the response.

Additionally, vendors will need at least one purpose with a configured legal basis to be returned in the response.


Command

////call the __tcfapi() function from the browser console with the getVendorPurposeMapping command
__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });
...
function show_vpm(vpm)  {
    for(i in vpm)   {
       var vendor = vpm[i];
       var vendor_id = vendor.vendorId;
       console.log(" ");
       console.log("for vendor - " + vendor_id);
       var all_categories = vendor.categories;
       for(j in all_categories) {
          var category = all_categories[j];               
          var purpose_id = category._id;
          var leg_basis = category.type;
          console.log(">> the purpose id is - " + purpose_id);
          console.log(">> the legal basis is - " + leg_basis);
       }
    }
 }

 __tcfapi('getVendorPurposeMapping', 2, function(vpm, success) {
    show_vpm(vpm)
 });  
...

Response

[
  {
    "categories": [
      {
        "type": "CONSENT",
        "_id": "1234e01e32bd4d27654b5678"
      }
    ],
    "vendorId": "abcd2fbeb8e05c306f2aefgh"
  }
]
schema:
    description: Returned response to vendor purpose mapping
    type: array
    items:
      type: object
      properties:
        categories:
          type: array
          description: Details purposes configured for each vendor
          items:
            type: object
            properties:
              type:
                type: string
                description: Legal basis configured for purpose
              _id:
                type: string
                description: Unique ID for purpose
        vendorId:
          type: string
          description: Unique ID for a vendor