The Apply Targeting Sets API function is implemented as Apex class and is exposed as REST web service by using Salesforce standard functionality (see Apex Developer Guide for more information). For general information about the dynamic pricing feature, see TODO
1. REST web service
1.1. URL
https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Campaign_Item__c/ApplyTargetingSets/
1.2. Method
PATCH
1.3. URL Params
-
1.4. Data Params
A JSON object with the attribute campaignItems, containing a JSON serialized list of Campaign Items. And a second attribute targetingSetIds (JSON serialized List<List<Id>>). The lists have to have the same size, the Targeting Set Ids of the first list entry will be applied to the first list entry of the campaignItems list and so on.
Example: { "campaignItems":[{<Campaign Item>}, ...], "targetingSetIds":["a2d1X0000004zsCQAQ", ...]}
1.5. Success Response
Code: 200
Content: A JSON serialized list of the Campaign Items from the request body, but now with updated targeting fields.
Example: [{<Campaign Item>}, ...]
1.6. Error Response
See Salesforce Apex REST Documentation
1.7. Logic
1.8. Examples
1.8.1. Get a Session-ID
curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=<CLIENT_ID>" -d "client_secret=<CLIENT_SECRET>" -d "username=<USER_NAME>" -d "password=<PASSWORD+TOKEN>" -H 'X-PrettyPrint:1'
Connected App
Get CLIENT_ID and CLIENT_SECRET from any connected app or create a new app in your org: App Manager -> New Connected App
1.8.2. Simple request
1.9. Usage in Apex
List<ADvendio__Campaign_Item__c> cis = ... List<List<Id>> targetingSetIds = ... cis = ADvendio.TargetingSets.applyTargetingSets(cis,targetingSetIds);