2. Retrieve the user's Ad Accounts (sponsoredAccount)
GET {{baseUrl}}/adAccounts?q=search&search=(type:(values:List(BUSINESS)),status:(values:List(ACTIVE)),test:false)&fields=id,name,test,reference
View Search for Accounts documentation for more information.
This API call pulls back Ad Accounts that the member has access to where the status = ACTIVE, type = BUSINESS, and test = false (NOT a test Ad Account).
Learn more about Test Ad Accounts here.
For testing purposes, if you wish to use this example api to pull back a Test Ad Account, simply remove test:false
from the search parameter.
3. Ask the user to select the Ad Account where the audience should be created
4. Create a CSV file to upload
5. Upload the CSV file using the below curl command
curl --form fileupload=@filename.csv;type=text/csv
-H 'Authorization: Bearer ' https://api.linkedin.com/media/upload?mediatype=adsegments
See our online documentation for [example CSV file templates] See [Upload List File] in our online documentation for details on this API.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
q | string | ||
search | string | ||
fields | string |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
X-Restli-Protocol-Version | string | ||
LinkedIn-Version | string | ||
Authorization | string |
RESPONSES
status: OK
{"paging":{"start":0,"count":10,"links":[],"total":2},"elements":[{"name":"Test ad account","reference":"urn:li:organization:11223344","id":123456,"test":false},{"name":"MDO ad account","reference":"urn:li:organization:2355689","id":456789,"test":false}]}