Get Campaigns

This returns a list of campaigns.

Overview

This request requires an access token with “campaigns-read” scope.

URI

GET: https://rest.bronto.com/campaigns?page=1&perPage=30&sort=id&order=asc&archived=false

Parameters

Parameter Type Default Value Description
page Integer 1 Page to list results from.
perPage Integer 30 Number of results displayed per page. If perPage is set to 5 and you have 10 results, then you will see 5 results on page 1 and 5 results on page 2.
sort String Campaign ID Sort results by field. Possible values:
  • id: campaign ID
  • created: date the campaign was created
  • modified: date the campaign was last modified
  • type: campaign type (Example: Birthday)
  • name: campaign name
order String Ascending The order that results will be displayed in, either ascending or descending. Possible values:
  • asc
    : ascending
  • desc: descending
search String Search for a campaign by name. You must enter the entire campaign name.
typeIds List Limit results from campaigns with specific type IDs (Example query string: typeIDs=1&typeIDs=4).
archived Boolean false Limit results to archived campaigns. Possible values:
  • true
  • false

Response

A response containing the campaign with the given ID.

[
  {
    "id": number,
    "siteId": number,
    "createdDate": ISO-8601 datetime,
    "modifiedDate": ISO-8601 datetime,
    "campaignTypeId": number,
    "name": string,
    "description": string,
    "archived": boolean
  }
]

Python Code Example

from __future__ import print_function
 
# Requests documentation:  http://docs.python-requests.org/
import requests
 
 
# API authorization
bronto_access_token = "access token"
session = requests.Session()
session.headers["Authorization"] = "Bearer " + bronto_access_token
 
url = "https://rest.bronto.com/campaigns/"
 
response = session.get(url)
 
if response.ok:
    campaigns = response.json()
    print("campaigns:", campaigns)
else:
    print("Could not get campaigns (status code={}, content='{}', headers={})".format(
        response.status_code, response.text, response.headers
    ))