Subscription API - Documentation

In order to use the Subscription API, your Salesforce Org needs to have API usage activated through having an API usage License. You also need to have the finance license.
Otherwise you will get the error “This feature is not part of your current ADvendio license.“ returned.

For general information about the Subscription feature, see https://advendio.atlassian.net/wiki/spaces/SO/pages/1403617323.

Please take note that the Subscription API consists of 2 different calls:

1. Create (initial) Media Campaign

The API call for the creation of the initial Media Campaign creation requires your Subscription Contract as well as the Subscription Ad Price Assignments to be set up correctly.
With those records you can start the API which will result in your initial Media Campaign getting created similar to how you would do it via the action button in the UI: https://advendio.atlassian.net/wiki/spaces/SO/pages/1403617323#How-to-Invoice-your-Subscription-Contracts%3F

URL

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Subscription__c/InitialMediaCampaignCreation/*

Method

PATCH

URL Parameters

-

Data Parameters

A JSON string with the subscription record id to use the API action for creating the first Media Campaign.

Example:

{ "subscriptionId": "a2o2K000000ZLWMQA4" }

Success response

Code: 200

Content: A JSON string with the newly created Media Campaign id.

Example:

{ "ADvendio__MediaCampaign__c" : { "Id": "a1v3OooooooMZakQAG" } }

Error response

See Salesforce Apex REST Documentation

Possible errors will be returned as a string:

  • “Media Campaigns can only be created for active Subscription Contracts with the status closed-won.“

  • “Unknown error“

2. End Non Digital Assignment

The API will only be used for non digital inventory for now. The logic will be ignoring pre-invoice generation and simply do the end assignment logic from the UI action button: https://advendio.atlassian.net/wiki/spaces/SO/pages/1568866309/6.12.2+How+to+Update+Running+Subscription+Contracts#Prematurely-Ending-a-Subscription-Ad-Price-Assignment-in-a-Running-Subscription-Contract

URL

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Subscription__c/EndNonDigitalAssignment/*

Method

PATCH

URL Parameters

-

Data Parameters

The API requires a JSON string with the subscription ad price assignment id and the until date to use the API action. The new quantity will be calculated automatically but can also be set manually.

Example:

{ "assigmentId": "a2i1j000001JDSPAA4", "untilDate": "2021-11-24" }

Success response

Code: 204

See Salesforce Apex REST Documentation

Error response

See Salesforce Apex REST Documentation

Possible errors will be returned as a string:

  • “No Campaign Item found.“

  • “You can end only non digital assignments.“

  • “The campaign item has already ended.“

  • “The End Campaign Item process is already completed.“