Set your Polytomic API key as an environment variable:
This example covers six steps:
The Snowflake instance must be reachable from Polytomic over the network. For details, see the Snowflake connection guide.
The following request creates a LinkedIn Ads Connection. See the LinkedIn Ads connection configuration for the required fields.
LinkedIn Ads Connections authenticate with OAuth. Open the URL returned in the auth_url field of the response to complete the flow.
By default, the API expects auth_url to open in a new browser window.
Set the optional redirect_url parameter in the request body to change
the redirect target.
A LinkedIn Ads Connection can pull data from multiple ad accounts. To choose which ones, fetch the available connection parameters, then update the account list on the Connection.
Use those values to update the Connection.
Create a model backed by a Snowflake query:
For information about how to enumerate sources, see this example.
Retrieve the audiences available on a LinkedIn Ads Connection by listing the target objects for that Connection.
To write to an existing LinkedIn Ads audience, set the audience ID as the target object on the sync.
The following sync maps email, first_name, and last_name from the Snowflake model to the corresponding LinkedIn Ads fields. Add more entries to the fields array to sync additional columns.
To write to a new audience, pass the audience’s creation properties in the target object of the sync request.
The required properties come from the target_creation section of the target objects list response.
The Step 4 response shows that LinkedIn Ads supports creating destinations and requires three properties:
accounttypenameBoth account and type are marked "enum": true, so you can fetch their allowed values from the property values endpoint.
Fetching account returns the ad accounts enabled on the Connection:
Fetching type returns the supported audience types:
Instead of setting a target object, pass these properties as a create object on the target. For example: