Campaigns Version 1
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 summaries (titles), actions, descriptions, 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
- Field names and descriptions
- Links
- Scenario: Retrieving a collection of campaign resources (GET)
- Scenario: Retrieving an individual campaign resource (GET)
- Scenario: POST/PUT/DELETE
Endpoints and URL structures
Endpoints:
https://actionnetwork.org/api/v1/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/v1/campaigns/[id]
To address a specific campaign, use the identifier without the action_network:
prefix to construct a URL, like https://actionnetwork.org/api/v1/campaigns/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3
Field names and descriptions
Field Name | Type | Required on POST | Description |
---|---|---|---|
identifiers | array[] | n/a |
An array of identifiers in the format [system name]:[id] . See the general concepts document for more information about identifiers.
|
originating_system | string | n/a | A human readable string identifying where this campaign originated. May be used in the user interface for this purpose. |
created_at | datetime | n/a | The date and time the resource was created. System generated, not editable. |
modified_at | datetime | n/a | The date and time the resource was last modified. System generated, not editable. |
summary | string | n/a | The campaign's title. |
description | string | n/a | The campaign's description. May contain HTML. |
url | string | n/a | The URL to this campaign's public page on the Action Network. |
actions | array[] | n/a | An array of hashes identifying the actions this campaign links to on its public page. |
actions.summary | string | n/a | The title of the action linked on the public page of this campaign. |
actions.url | string | n/a | The link to the public page of this action that's linked on the public page of this campaign. |
action_network:sponsor | hash | n/a | A hash of the sponsoring group of this campaign. Action Network-only feature. Automatically added if you post using a group API key. System generated, not editable. |
action_network:sponsor.summary | string | n/a | The name of the sponsoring group. |
action_network:sponsor.url | string | n/a | The URL to the group's public page. |
Links
Link Name | Description |
---|---|
self | A link to this individual campaign resource. |
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/v1/campaigns/
Header:
api-key:[your api key here]
Response
Back To Top ↑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/v1/campaigns?page=2" }, "self": { "href": "https://actionnetwork.org/api/v1/campaigns" }, "action_network:campaigns": [ { "href": "https://actionnetwork.org/api/v1/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" }, { "href": "https://actionnetwork.org/api/v1/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29" }, //truncated for brevity ], "curies": [ { "name": "osdi", "href": "https://actionnetwork.org/docs/v1/{rel}", "templated": true }, { "name": "action_network", "href": "https://actionnetwork.org/docs/v1/{rel}", "templated": true } ] }, "_embedded": { "action_network:campaigns": [ { "identifiers": [ "action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29" ], "originating_system": "Action Network" "created_at": "2013-10-02T14:21:32Z", "modified_at": "2013-10-02T14:22:06Z", "summary": "Join our week of actions!", "description": "<p>Our week of action is here -- click the links on the right to join in!</p>", "url": "https://actionnetwork.org/campaigns/join-our-week-of-action", "action_network:sponsor": { "summary": "Progressive Action Now", "url": "https://actionnetwork.org/groups/progressive-action-now" }, "actions": [ { "summary": "Sign the petition", "url": "https://actionnetwork.org/petitions/sign-the-petition" }, { "summary": "Attend the rally", "url": "https://actionnetwork.org/events/attend-the-rally" } ], "_links": { "self": { "href": "https://actionnetwork.org/api/v1/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" } } }, { "identifiers": [ "action_network:e7b0287e-a0a9-11e3-a2e9-12313d316c29" ], "originating_system": "Action Network" "created_at": "2013-09-30T15:55:44Z", "modified_at": "2014-01-16T19:07:00Z", "summary": "Welcome to our Action Center", "description": "<p>Welcome to our Action Center. Take action on the right.</p>", "url": "https://actionnetwork.org/campaigns/welcome-to-our-action-center", "action_network:sponsor": { "summary": "Progressive Action Now", "url": "https://actionnetwork.org/groups/progressive-action-now" }, "actions": [ { "summary": "Sign up for email updates", "url": "https://actionnetwork.org/forms/sign-up-for-email-updates" }, { "summary": "Take our survey", "url": "https://actionnetwork.org/forms/take-our-survey" } ], "_links": { "self": { "href": "https://actionnetwork.org/api/v1/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29" } } }, //truncated for brevity ] } }
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/v1/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29
Header:
api-key:[your api key here]
Response
Back To Top ↑200 OK Content-Type: application/hal+json Cache-Control: max-age=0, private, must-revalidate
{ "identifiers": [ "action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29" ], "originating_system": "Action Network" "created_at": "2013-10-02T14:21:32Z", "modified_at": "2013-10-02T14:22:06Z", "summary": "Join our week of actions!", "description": "<p>Our week of action is here -- click the links on the right to join in!</p>", "url": "https://actionnetwork.org/campaigns/join-our-week-of-action", "action_network:sponsor": { "summary": "Progressive Action Now", "url": "https://actionnetwork.org/groups/progressive-action-now" }, "actions": [ { "summary": "Sign the petition", "url": "https://actionnetwork.org/petitions/sign-the-petition" }, { "summary": "Attend the rally", "url": "https://actionnetwork.org/events/attend-the-rally" } ], "_links": { "self": { "href": "https://actionnetwork.org/api/v1/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" }, "curies": [ { "name": "osdi", "href": "https://actionnetwork.org/docs/v1/{rel}", "templated": true }, { "name": "action_network", "href": "https://actionnetwork.org/docs/v1/{rel}", "templated": true } ] } }
Scenario: POST/PUT/DELETE
Posting, putting, and deleting campaigns is not allowed. Attempts will result in errors.
Back To Top ↑