Programmatic Data Import API - Documentation

 Content

Table of Contents

In order to use the Programmatic Data Import API, your Salesforce Org needs to have API usage activated through having an API usage License. 

The Programmatic Data Import 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 Forecast API feature, see 4.4 Availability Forecast.

1. REST web service

1.1. URL

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ProgrammaticDataService/loadCSV/

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ProgrammaticDataService/loadCSV/


1.2. Method

POST

1.3. URL Params


NameValueDescription
idex: a0M5r000000xkfkEAASalesforce id of the connection object to which the data to be imported is related to.


1.4. Body

The request body should content a csv file binary containing the data to be imported according the following mapping. More information about the mapping and the file to attach can be found here: 7.7.8.6.1 How to structure CSV for generic Programmatic Revenue upload and how mapping is defined


CSV Column

Type

Required

Imported in object/field

month

String

X

ProgrammaticDataWorkingSet__c.ADvendio__Month__c

advertiserId

String


ProgrammaticAdvertiser__c.ADvendio__AdvertiserId__c

ProgrammaticDataWorkingSet__c.ADvendio__AdvertiserId__c

advertiserName

String


ProgrammaticAdvertiser__c.ADvendio__AdvertiserName__c

ProgrammaticDataWorkingSet__c.ADvendio__AdvertiserName__c

partnerName

String


ProgrammaticPartner__c.ADvendio__PartnerName__c

ProgrammaticDataWorkingSet__c.ADvendio__SSPPartner__c

adUnitId

String


ProgrammaticPrice__c.ADvendio__AdUnitId__c

ProgrammaticDataWorkingSet__c.ADvendio__AdUnitId__c

adUnitName

String


ProgrammaticPrice__c.ADvendio__AdUnitName__c

ProgrammaticDataWorkingSet__c.ADvendio__AdUnitName__c

dealType

String


ProgrammaticPrice__c.ADvendio__DealType__c

ProgrammaticDataWorkingSet__c.ADvendio__DealType__c

costType

String


ProgrammaticPrice__c.ADvendio__CostType__c

ProgrammaticDataWorkingSet__c.ADvendio__CostType__c

creativeSize

String


ProgrammaticPrice__c.ADvendio__CreativeSize__c

ProgrammaticDataWorkingSet__c.ADvendio__CreativeSize__c

currencyCode

String


ProgrammaticPrice__c.CurrencyIsoCode

ProgrammaticDataWorkingSet__c.CurrencyIsoCode

impressions

Number


ProgrammaticDataWorkingSet__c.ADvendio__Impressions__c

clicks

Number


ProgrammaticDataWorkingSet__c.ADvendio__Clicks__c

revenue

Number


ProgrammaticDataWorkingSet__c.ADvendio__Revenue__c

1.5. Success Response

Code: 200

Content: A serialized JSON with the batch job id that will handle the import process.

Example: {"jobId":"7075r00001lfCmsAAE"}

1.6. Error Response

See Salesforce Apex REST Documentation

1.7. Examples

1.7.1. Get a Session-ID

Get a Session ID
curl -v https://<my-domain-name>.my.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

Enable Enable OAuth Settings to see the consumer key (CLIENT_ID) and Consumer Secret (CLIENT_SECRET)

1.7.2. Minimal request

A simple request for a data set connected to an Ad Server.

Call Check Availability web service
curl https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ProgrammaticDataService/loadCSV?id=<CONNECTION_ID> -H 'Authorization: Bearer <SESSION_ID>' -H "Content-Type: text/csv" -H 'X-PrettyPrint:1' --data-binary @<CSV_FILE_NAME> --request POST
Response
{
	"jobId":"7075r00001lfCmsAAE"
}