Tutorial: Get Action Takers Version 1

Note: This tutorial describes Version 1 of our API, which is now depreciated. It will continue to work, but it will not reveive any updates or bug fixes. We recommend you use Version 2 instead. The tutorial for Version 2 of our API is available here.

This tutorial demonstrates how to get a list of people who have taken one of your actions (in this case, signed a petition).

Steps:

Calling a specific petition

From the API entry point, navigate to the action type you're interested in, and then the specific action you'd like to call. In this tutorial, we'll be getting a list of people who signed a specific petition. Call the individual petition you're interested in like so:

						
GET https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/

Header:
api-key:[your api key here]
					

Which will return a response like this:

						
200 OK

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


{
  "identifiers": [
    "action_network:7580a324-9a72-11e3-a2e9-12313d316c29"
  ],
  "created_at": "2014-02-06T16:04:05Z",
  "modified_at": "2014-02-20T21:16:57Z",
  "summary": "Stop doing the bad thing",
  "description": "<p>Please stop doing this really bad thing.</p>",
  "petition_text": "Mayor Doe, stop doing the bad thing.",
  "url": "https://actionnetwork.org/petitions/stop-doing-the-bad-thing",
  "total_signatures": 2637,
  "target": [
    {
      "name": "Mayor Doe"
    }
  ],
  "_embedded": {
    "osdi:creator": {
      "given_name": "John",
      "family_name": "Smith",
      "identifiers": [
        "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29"
      ],
      "email_addresses": [
        {
          "primary": true,
          "address": "jsmith@mail.com"
        }
      ],
      "postal_addresses": [
        {
          "primary": true,
          "address_lines": [
            "1600 Pennsylvanie Ave."
          ],
          "locality": "Washington",
          "region": "DC",
          "postal_code": "20009",
          "country": "US",
          "language": "en",
          "location": {
            "latitude": 38.919,
            "longitude": -77.0379,
            "accuracy": "Approximate"
          }
        }
      ],
      "_links": {
        "self": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
        },
        "osdi:question_answers": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29/question_answers"
        },
        "osdi:attendance": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendance"
        },
        "osdi:signatures": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures"
        },
        "osdi:submissions": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions"
        },
        "osdi:donations": {
          "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations"
        },
        "curies": [
          {
            "name": "osdi",
            "href": "https://actionnetwork.org/docs/v1/{rel}",
            "templated": true
          },
          {
            "name": "action_network",
            "href": "https://actionnetwork.org/docs/v1/{rel}",
            "templated": true
          }
        ]
      }
    }
  },
  "_links": {
    "self": {
      "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
    },
    "osdi:signatures": {
      "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "osdi:creator": {
      "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
    },
    "action_network:embed": {
      "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/embed"
    },
    "curies": [
      {
        "name": "osdi",
        "href": "https://actionnetwork.org/docs/v1/{rel}",
        "templated": true
      },
      {
        "name": "action_network",
        "href": "https://actionnetwork.org/docs/v1/{rel}",
        "templated": true
      }
    ]
  }
}
					

In the response you are able to see and parse data about this petition -- the petition's name, the URL to the signature page on the Action Network, who created the petition, the total number of signers, etc...

Back To Top ↑

Calling the signatures collection

Using the links provided, you can view the list of signature resources on this petition, each one representing the action a signer took when they entered their information to sign this petition. (Note: Signatures are deduplicated on person, so a person may only sign a petition once.)

Call the signatures collection like this:

						
GET https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/

Header:
api-key:[your api key here]
					

Which will return a response like this:

						
200 OK

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


{
  "total_pages": 1,
  "per_page": 25,
  "page": 1,
  "total_records": 2637,
  "_links": {
    "self": {
      "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "record_signatures_helper": {
      "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "osdi:signatures": [
      {
        "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
      },
      {
        "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/7567ff72-9a72-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": {
    "osdi:signatures": [
      {
        "identifiers": [
	      "action_network:779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
        ],
        "created_at": "2014-02-20T21:16:57Z",
        "modified_at": "2014-02-20T21:16:57Z",
        "comments": "Stop doing the bad thing!",
        "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29",
        "action_network:petition_id": "7580a324-9a72-11e3-a2e9-12313d316c29",
        "_links": {
          "self": {
            "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
          },
          "osdi:petition": {
            "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:person": {
            "href": "https://actionnetwork.org/api/v1/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
          }
        }
      },
      {
        "identifiers": [
	      "action_network:7567ff72-9a72-11e3-a2e9-12313d316c29"
        ],
        "created_at": "2014-02-07T13:03:32Z",
        "modified_at": "2014-02-07T13:03:32Z",
        "action_network:person_id": "699dae88-929f-11e3-a2e9-12313d316c29",
        "action_network:petition_id": "7580a324-9a72-11e3-a2e9-12313d316c29",
        "_links": {
          "self": {
            "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/7567ff72-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:petition": {
            "href": "https://actionnetwork.org/api/v1/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:person": {
            "href": "https://actionnetwork.org/api/v1/people/699dae88-929f-11e3-a2e9-12313d316c29"
          }
        }
      },
      //truncated for brevity
    ]
  }
}
					

Here you can see a list of every signature and comments each person left when they signed. Again note that signatures are deduplicated, so you won't see the same person represented more than once.

You can see details about each person who signed (like their name or email address) by following the link labeled osdi:person to their individual person record.

Click here for full documentation of signature resources.

Next Tutorial: Get the embed code for a form you created

Back To Top ↑