Campaigns Version 2

This document describes the campaigns collection and campaign resource as implemented by the Action Network.

Campaigns are resources created by the group associated with your API key. They correspond to campaign pages created in the Action Network user interface.

Campaigns have names (corresponding to our administrative titles), titles, and can have descriptions, actions, and other fields.

Note: Campaigns are read-only and can only be created and manipulated by groups, so they will not appear using an individual API key.

Sections:

Endpoints and URL structures

Endpoints:

https://actionnetwork.org/api/v2/campaigns

Campaign resources live exclusively at the above endpoint. The endpoint returns a collection of all the campaigns associated with your API key.

URL Structures:

https://actionnetwork.org/api/v2/campaigns/[id]

To address a specific campaign, use the identifier without the action_network: prefix to construct a URL, like https://actionnetwork.org/api/v2/campaigns/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3

Back To Top ↑

Field names and descriptions

Campaign fields:
Field Name Type Required on POST Description
identifiers strings[] n/a An array of identifiers in the format [system name]:[id]. See the general concepts document for more information about identifiers.
origin_system string n/a A human readable string identifying where this campaign originated. May be used in the user interface for this purpose.
created_date datetime n/a The date and time the resource was created. System generated, not editable.
modified_date datetime n/a The date and time the resource was last modified. System generated, not editable.
name string n/a The campaign's administrative title, only shown internally and not publicly.
title string n/a The campaign's public title.
description string n/a The campaign's description. May contain HTML.
browser_url string n/a The URL to this campaign's public page on the Action Network.
featured_image_url string The URL to this action's featured image on the Action Network, if a banner image has been set. Not editable.
action_network:hidden boolean A read-only field indicating whether this action is hidden in our user interface or not.
actions Actions[] n/a An array of hashes identifying the actions this campaign links to on its public page.
action_network:sponsor Sponsor A hash of the sponsoring group of this event. Action Network-only feature. Automatically added if you post using a group API key. System generated, not editable.
Actions fields:
Field Name Type Required on POST Description
title string n/a The title of the action linked on the public page of this campaign.
browser_url string n/a The link to the public page of this action that's linked on the public page of this campaign.
Sponsor fields:
Field Name Type Required on POST Description
title string n/a The name of the sponsoring group.
browser_url string n/a The URL to the group's public page.
Back To Top ↑

Links

Link Name Description
self A link to this individual campaign resource.
Back To Top ↑

Scenario: Retrieving a collection of campaign resources (GET)

Campaign resources are sometimes presented as collections of campaigns. For example, calling the campaigns endpoint will return a collection of all the campaigns associated with your API key.

Request

						
GET https://actionnetwork.org/api/v2/campaigns/

Header:
OSDI-API-Token: your_api_key_here
					

Response

						
200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate


{
  "total_pages": 2,
  "per_page": 25,
  "page": 1,
  "total_records": 30,
  "_links": {
    "next": {
      "href": "https://actionnetwork.org/api/v2/campaigns?page=2"
    },
    "self": {
      "href": "https://actionnetwork.org/api/v2/campaigns"
    },
    "action_network:campaigns": [
      {
        "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29"
      },
      {
        "href": "https://actionnetwork.org/api/v2/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29"
      },
      //truncated for brevity
    ],
    "curies": [
      {
        "name": "osdi",
        "href": "https://actionnetwork.org/docs/v2/{rel}",
        "templated": true
      },
      {
        "name": "action_network",
        "href": "https://actionnetwork.org/docs/v2/{rel}",
        "templated": true
      }
    ]
  },
  "_embedded": {
    "action_network:campaigns": [
      {
        "identifiers": [
          "action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29"
        ],
        "origin_system": "Action Network",
        "created_date": "2013-10-02T14:21:32Z",
        "modified_date": "2013-10-02T14:22:06Z",
        "title": "Join our week of actions!",
        "description": "<p>Our week of action is here -- click the links on the right to join in!</p>",
        "browser_url": "https://actionnetwork.org/campaigns/join-our-week-of-action",
        "featured_image_url": "https://actionnetwork.org/images/week-of-action.jpg",
        "action_network:hidden": false,
        "action_network:sponsor": {
          "title": "Progressive Action Now",
          "browser_url": "https://actionnetwork.org/groups/progressive-action-now"
        },
        "actions": [
          {
            "title": "Sign the petition",
            "browser_url": "https://actionnetwork.org/petitions/sign-the-petition"
          },
          {
            "title": "Attend the rally",
            "browser_url": "https://actionnetwork.org/events/attend-the-rally"
          }
        ],
        "_links": {
          "self": {
            "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29"
          }
        }
      },
      {
        "identifiers": [
          "action_network:e7b0287e-a0a9-11e3-a2e9-12313d316c29"
        ],
        "origin_system": "Action Network",
        "created_date": "2013-09-30T15:55:44Z",
        "modified_date": "2014-01-16T19:07:00Z",
        "title": "Welcome to our Action Center",
        "description": "<p>Welcome to our Action Center. Take action on the right.</p>",
        "browser_url": "https://actionnetwork.org/campaigns/welcome-to-our-action-center",
        "action_network:sponsor": {
          "title": "Progressive Action Now",
          "browser_url": "https://actionnetwork.org/groups/progressive-action-now"
        },
        "actions": [
          {
            "title": "Sign up for email updates",
            "browser_url": "https://actionnetwork.org/forms/sign-up-for-email-updates"
          },
          {
            "title": "Take our survey",
            "browser_url": "https://actionnetwork.org/forms/take-our-survey"
          }
        ],
        "_links": {
          "self": {
            "href": "https://actionnetwork.org/api/v2/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29"
          }
        }
      },
      //truncated for brevity
    ]
  }
}
					
Back To Top ↑

Scenario: Retrieving an individual campaign resource (GET)

Calling an individual campaign resource will return the resource directly, along with all associated fields and appropriate links to additional information about the campaign.

Request

						
GET https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29

Header:
OSDI-API-Token: your_api_key_here
					

Response

						
200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate


{
  "identifiers": [
    "action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29"
  ],
  "origin_system": "Action Network",
  "created_date": "2013-10-02T14:21:32Z",
  "modified_date": "2013-10-02T14:22:06Z",
  "title": "Join our week of actions!",
  "description": "<p>Our week of action is here -- click the links on the right to join in!</p>",
  "browser_url": "https://actionnetwork.org/campaigns/join-our-week-of-action",
  "featured_image_url": "https://actionnetwork.org/images/week-of-action.jpg",
  "action_network:hidden": false,
  "action_network:sponsor": {
    "title": "Progressive Action Now",
    "browser_url": "https://actionnetwork.org/groups/progressive-action-now"
  },
  "actions": [
    {
      "title": "Sign the petition",
      "browser_url": "https://actionnetwork.org/petitions/sign-the-petition"
    },
    {
      "title": "Attend the rally",
      "browser_url": "https://actionnetwork.org/events/attend-the-rally"
    }
  ],
  "_links": {
    "self": {
      "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29"
    },
    "curies": [
      {
        "name": "osdi",
        "href": "https://actionnetwork.org/docs/v2/{rel}",
        "templated": true
      },
      {
        "name": "action_network",
        "href": "https://actionnetwork.org/docs/v2/{rel}",
        "templated": true
      }
    ]
  }
}
					
Back To Top ↑

Scenario: POST/PUT/DELETE

Posting, putting, and deleting campaigns is not allowed. Attempts will result in errors.

Back To Top ↑