Phoenix Documentation
Phoenix ProductionPhoenix PreviewContentful
Primary version
Primary version
  • 🔥Phoenix 🔥
  • Installation + Usage
    • Prerequisites
    • Installation
    • Usage
  • Development
    • Architecture
      • Heroku
    • Content Types
      • Action Stats Block
      • Campaign
      • Content Block
      • Cause Page
      • Company Page
      • Current Club Block
      • Current School Block
      • Embed
      • External Link
      • Landing Page
      • Link Action
      • Metadata
      • Page
      • Photo Submission Action
      • Selection Submission Action
      • Share Action
      • Signup Referrals Block
      • Social Drive Action
      • Voter Registration Action
      • Voter Registration Drive Action
      • Voter Registration Marketing Page
      • Voter Registration Referrals Block
    • Features
      • Affiliate Opt In
      • Affiliate Scholarship Block
      • Analytics Waypoint
      • Delayed Element
      • Dismissable Element
      • Stat Card
      • General Buttons
      • Groups
      • Paginated Campaign Gallery
      • Popover Dispatcher
      • Refer A Friend
      • Referrals Gallery
      • Sitewide Banner
      • Sixpack A/B Testing
        • Code Tests
        • Contentful Tests
        • Testing Tips
      • Tooltip
      • Traffic Distribution
      • Volunteer Credits
      • Voter Registration
      • Zendesk Form
    • Contentful
      • Workflow
      • Content Management API Scripts
    • Helpers
  • Phoenix API
    • v2
      • Campaigns Resource
      • Posts Resource
      • Zendesk Endpoint
  • Data + Performance
    • Monitoring
    • Analytics
    • Logging
  • Contributing Instructions
    • Edit This Documentation
    • Glossary
Powered by GitBook
On this page
  • Retrieve all Campaigns
  • Retrieve a single Campaign
  • Retrieve all Posts for a Campaign
  • Create a Post for a Campaign
  1. Phoenix API
  2. v2

Campaigns Resource

List of API endpoints for the Campaigns resource.

Retrieve all Campaigns

GET https://www.dosomething.org/api/v2/campaigns

Get an index list of all campaigns, filterable using query parameters.

Query Parameters

Name
Type
Description

filter[id]

string

e.g.: 37,6LQzMvDNQcYQYwso8qSkQ8

{
  "data": [
    {
      "id": "6LQzMvDNQcYQYwso8qSkQ8",
      "legacyCampaignId": "1144",
      "legacyCampaignRunId": "7430",
      "type": "campaign",
      "title": "[Test] Teens for Jeans",
      "slug": "test-teens-for-jeans",
      "status": null,
      "endDate": {
        "date": "2019-01-01 12:00:00.000000",
        "timezone_type": 1,
        "timezone": "-06:00"
      },
      "callToAction": "Let's collect another million jeans TOGETHER.",
      "tagline": "Let's collect another million jeans TOGETHER.",
      "coverImage": {
        "description": null,
        "url":
          "https://images.ctfassets.net/81iqaqpfd8fy/4k8rv5sN0kii0AoCawc6UQ/c22c3c132d1bb43055b6bafc248fcea5/vn7gpbosm9rx.jpg",
        "landscapeUrl":
          "https://images.ctfassets.net/81iqaqpfd8fy/4k8rv5sN0kii0AoCawc6UQ/c22c3c132d1bb43055b6bafc248fcea5/vn7gpbosm9rx.jpg?w=1440&h=620&fm=jpg&fit=fill"
      },
      "actionText": "Join Now",
      "staffPick": null,
      "cause": null,
      "scholarshipAmount": null,
      "additionalContent": {
        "noun": {
          "plural": "jeans",
          "singular": "jean"
        },
        "verb": {
          "plural": "collected",
          "singular": "collected"
        }
      }
    },
    {
      "id": null,
      "legacyCampaignId": "37",
      "legacyCampaignRunId": "6188",
      "type": "campaign",
      "title": "Music March Out",
      "slug": null,
      "status": "active",
      "callToAction":
        "Run a musical walk out to defend music program funding at school.",
      "tagline":
        "Run a musical walk out to defend music program funding at school.",
      "coverImage": {
        "description": null,
        "url":
          "https://thor.dosomething.org/sites/default/files/styles/300x300/public/images/Music%20March%20Out%20square.jpg?itok=luE_GV4M",
        "landscapeUrl":
          "https://thor.dosomething.org/sites/default/files/styles/1440x810/public/images/Music%20March%20Out%20landscape.jpg?itok=EzoA7Zvn"
      },
      "staffPick": false,
      "cause": "education",
      "additionalContent": {
        "noun": {
          "singular": null,
          "plural": "Protesters"
        },
        "verb": {
          "singular": null,
          "plural": "Attended"
        }
      }
    }
  ]
}

Currently, this endpoint only supports a filtered ID query and returns an abridged set of primary campaign fields to reduce the data load. There is a limit of 10 IDs per request; both Ashes and Contentful Campaign IDs are supported.

Retrieve a single Campaign

GET https://www.dosomething.org/api/v2/campaigns/:id

Get a single campaign using a specified id.

Path Parameters

Name
Type
Description

id

string

e.g.: 6LQzMvDNQcYQYwso8qSkQ8

{
  "data": {
    "id": "6LQzMvDNQcYQYwso8qSkQ8",
    "legacyCampaignId": "1144",
    "legacyCampaignRunId": "7430",
    "type": "campaign",
    "template": "mosaic",
    "title": "[Test] Teens for Jeans",
    "slug": "test-teens-for-jeans",
    "endDate": {
      "date": "2018-02-15 12:00:00.000000",
      "timezone_type": 1,
      "timezone": "-06:00"
    },
    "callToAction": "Let's collect another million jeans TOGETHER.",
    "tagline": "Let's collect another million jeans TOGETHER.",
    "blurb": "",
    "coverImage": {
      "description": null,
      "url":
        "https://images.contentful.com/81iqaqpfd8fy/4k8rv5sN0kii0AoCawc6UQ/c22c3c132d1bb43055b6bafc248fcea5/vn7gpbosm9rx.jpg",
      "landscapeUrl":
        "https://images.contentful.com/81iqaqpfd8fy/4k8rv5sN0kii0AoCawc6UQ/c22c3c132d1bb43055b6bafc248fcea5/vn7gpbosm9rx.jpg?w=1440&h=620&fm=jpg&fit=fill"
    },
    "campaignLead": {
      "id": "4V3gy8KPBK4gAWuMGSKWuA",
      "type": "staff",
      "fields": {
        "name": "Adam Garner",
        "jobTitle": "Campaign Lead",
        "avatar":
          "https://images.contentful.com/81iqaqpfd8fy/5dN0SxEQrYeI8eKwOAOwia/179e972eae699c6377faa74d611a50a2/Adam_Garner_Headshot.png?w=600&h=600&fm=jpg&fit=fill",
        "email": "adam@dosomething.org"
      }
    },
    "affiliateSponsors": [],
    "affiliatePartners": [],
    "quizzes": [],
    "dashboard": null,
    "affirmation": null,
    "pages": [],
    "landingPage": null,
    "additionalContent": null,
    "allowExperiments": true,
    "actionText": "Join Us",
    "staffPick": null,
    "cause": null,
    "scholarshipAmount": null
  }
}

The id can be either a Contentful ID or an Ashes Legacy ID.

Retrieve all Posts for a Campaign

GET https://www.dosomething.org/api/v2/campaigns/:id/posts

Get an index list of all posts for a specified campaign.

Path Parameters

Name
Type
Description

id

string

e.g.: 6LQzMvDNQcYQYwso8qSkQ8

The request is proxied to Rogue and automatically adds the filter[campaign_id]=:id to the query params.

Create a Post for a Campaign

POST https://www.dosomething.org/api/v2/campaigns/:id/posts

Path Parameters

Name
Type
Description

id

string

e.g.: 3455

{
  "data": {
    "id": 123456,
    "signup_id": 9874563,
    "northstar_id": "551234567890abcdefghijkl",
    "media": {
      "url": "https://rogue-thor.dosomething.org/images/123456",
      "original_image_url":
        "https://ds-rogue-thor.s3.amazonaws.com/uploads/reportback-items/8496508-superlongstringidhere-1234567890.jpeg?time=1517330438",
      "caption": "Some awesome caption here!"
    },
    "quantity": "12",
    "tags": [],
    "reactions": {
      "reacted": false,
      "total": null
    },
    "status": "pending",
    "source": "sample-oauth",
    "remote_addr": "100.00.000.000",
    "created_at": "2018-01-30T16:40:37+00:00",
    "updated_at": "2018-01-30T16:40:37+00:00",
    "signup": {
      "data": {
        "id": 8496508,
        "northstar_id": "551234567890abcdefghijkl",
        "campaign_id": "3455",
        "campaign_run_id": 6498,
        "quantity": 72,
        "why_participated": null,
        "source": "sample-oauth",
        "details": null,
        "created_at": "2018-01-29T19:37:33+00:00",
        "updated_at": "2018-01-30T16:40:37+00:00"
      }
    }
  }
}

The request is proxied to Rogue and automatically adds the filter[campaign_id]=:id to the query params.

Previousv2NextPosts Resource

Last updated 4 years ago

Please refer to the for further information.

Rogue API Documentation