Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Numberedheadings

The Commitments API 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 4.16 Commitments. The Apply Commitments functionality finds and sets the matching conditions and applies the discounts from the matching Commitment Condition

REST web service

URL

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Campaign_Item__c/ApplyCommitments/

Method

PATCH

URL Params

Data Params

A JSON object with the attribute campaignItems, containing a JSON serialized list of Campaign Items.

Example: { "campaignItems":[{<Campaign Item>}, ...]}

Success Response

Code: 200

Content: A JSON serialized list of the Campaign Items from the request body, but now with updated discount and Commitment Condition fields.

Example: [{<Campaign Item>}, ...]

Error Response

See Salesforce Apex REST Documentation

Logic

Matching logic

A Commitment Condition matches if all criteria (Commitment Condition fields) match. If the Commitment Condition field is empty, it matches all Campaign Item values.

ADvendio__CommitmentCondition__c

ADvendio__Campaign_Item__c

Matching

ADvendio__AdvertisingMedium__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__Site__c

equals

ADvendio__MediaDifferentiation__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__r.ADvendio__MediaDifferentiation__c

equals

ADvendio__MediaSegment__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__MediaSegment__c

equals

ADvendio__MediaType__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__Site__r.ADvendio__MediaType__c

equals

ADvendio__Unit__c

ADvendio__Ad_price__r.ADvendio__PriceUnit__c

equals

ADvendio__AdPrice__c

ADvendio__Ad_price__c

equals

ADvendio__AdSpec__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__c

equals

ADvendio__AdType__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__c

equals

ADvendio__Placement__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__c

equals

ADvendio__Content__c

ADvendio__SelectedContents__r

contains

ADvendio__PageEquivalency__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__r.ADvendio__PageEquivalency__c

equals

Required fields/records

ADvendio version 2.140 and higher

ADvendio version 2.139 and below

  • ADvendio__Media_Campaign__c: ADvendio__SelectedCommitment__c record

  • ADvendio__Ad_Price__c

  • (for advanced mode) ADvendio__from_Date__c

  • (for advanced mode) ADvendio__until_Date__c

  • ADvendio__Media_Campaign__r.ADvendio__Commitment__c,ADvendio__AgencyEarningCommitment__c,ADvendio__ThirdPartyCommitment__c or ADvendio__Media_Campaign__c

  • ADvendio__Ad_Price__c

Fields referenced by the Ad Price (Ad Spec, Ad Type, Placement, Site ...) are automatically queried if not set.

Fields set/Records created by ApplyCommitments method

Depending on the linked Commitments and the matching Commitment Condition the following fields will be written and related records will be created:

ADvendio version 2.140 and higher

ADvendio version 2.139 and below

Rebate in Kind

  • Quantity__c

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • CommitmentRelevant__c

  • ConditionApplied__c

  • Quantity__c

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • CommitmentRelevant__c

  • ConditionApplied__c

Special Discount

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • ConditionApplied__c

  • ADvendio__AppliedCommitmentCondition__c

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • SpecialDiscountCondition__c (deprecated)

  • SpecialDiscountCondition__r (deprecated)

  • ConditionApplied__c

Scaled Discount

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • Rate_Discount_3_custom__c

  • Rate_Discount_2_custom__c

  • ConditionApplied__c

  • ADvendio__AppliedCommitmentCondition__c

  • Rate_Discount_4__c

  • Rate_Discount_3_custom__c

  • Rate_Discount_2_custom__c

  • SpecialDiscountCondition__c (deprecated)

  • Rate_Discount_4_Name__c

  • ScaledDiscountCondition__c (deprecated)

  • ScaledDiscountCondition__r (deprecated)

  • ConditionApplied__c

AgencyEarnings

  • ADvendio__AgencyEarnings__c

  • ADvendio__AppliedCommitmentCondition__c

  • ADvendio__AgencyEarnings__c

  • ADvendio__AgencyEarningsCondition__c (deprecated)

  • ADvendio__AgencyEarningsCondition__r (deprecated)

Third Party Discount

  • ThirdPartyCommissionCustom__c

  • ConditionApplied__c

  • ADvendio__AppliedCommitmentCondition__c

  • ThirdPartyCommissionCustom__c

  • TPCCondition__c (deprecated)

  • TPCCondition__r (deprecated)

  • ConditionApplied__c

Examples

Get a Session-ID

Get a Session ID
bash

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

Simple request

Simple Request (For Advanced Commitments Enabled and Advanced Commitments Not Enabled)

Simple request (Not Advanced Commitments): ADvendio version 2.139 and below

A simple request with a Commitment and Commitment Conditions matching the Campaign Item / Ad Price.

Call Dynamic Pricing web service:

bash

curl <https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Campaign_Item__c/ApplyCommitments/> -H 'Authorization: Bearer <SESSION_ID>' -H "Content-Type: application/json" -H 'X-PrettyPrint:1' -d @requestBody.txt --request PATCH

A simple request with a Commitment and Commitment Conditions matching the Campaign Item / Ad Price

Call Dynamic Pricing web service:

bash

curl <https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Campaign_Item__c/ApplyCommitments/> -H 'Authorization: Bearer <SESSION_ID>' -H "Content-Type: application/json" -H 'X-PrettyPrint:1' -d @requestBody.txt --request PATCH

ADvendio version

2.140 and higher

2.139 and below

requestBody.txt

js

Response

js

Usage in Apex