Versions Compared

Key

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

...

Note

In order to use the Dynamic Pricing API, your Salesforce Org needs to have API usage activated through having an API usage License. 


Note
titleCustom Matching criterion

Please make sure to add the relevant fields also to the Campaign Item you provide to the API method if you are using the Custom Matching Criteria as described here 8.4.6 Setup Price Rules/Dynamic Pricing (Feature Setting). Our logic will not query these fields by itself so missing this data might lead to not matching Price Rules. 


Numberedheadings
start-numbering-with1

The Dynamic Pricing 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 

REST web service

URL

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

Method

PATCH

URL Params

-

Data Params

A JSON object with the attribute campaignItems, what contains 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 surcharge and discount fields.

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

Error Response

See Salesforce Apex REST Documentation

Logic

Examples

Get a Session-ID

bashGet a Session ID


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

A simple request with a Price Rule, having all criteria fields empty (so it matches every Campaign Item) and setting surcharge B2 to 20%.

bashCall Dynamic Pricing web service


jsrequestBody.txt


jsResponse


Complex request

A more complex example to match the following Price Rule (additionally to more simple ones)

a more complex Price Rule


bashCall Dynamic Pricing web service


jsrequestBody.txt


jsResponse


Usage in Apex

java


...