Tutorial: Get Action Takers Version 2

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/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/

Header:
OSDI-API-Token: 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"
  ],
  "origin_system": "Action Network",
  "created_date": "2014-02-06T16:04:05Z",
  "modified_date": "2014-02-20T21:16:57Z",
  "title": "Stop doing the bad thing",
  "description": "<p>Please stop doing this really bad thing.</p>",
  "petition_text": "Mayor Doe, stop doing the bad thing.",
  "browser_url": "https://actionnetwork.org/petitions/stop-doing-the-bad-thing",
  "total_signatures": 2637,
  "target": [
    {
      "name": "Mayor Doe"
    }
  ],
  "action_network:hidden": false,
  "_embedded": {
    "osdi:creator": {
      "given_name": "John",
      "family_name": "Doe",
      "created_date": "2014-02-18T19:44:49Z",
      "modified_date": "2014-02-25T16:08:26Z",
      "identifiers": [
           "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29"
      ],
      "email_addresses": [
        {
          "primary": true,
          "address": "johndoe@mail.com",
          "status": "subscribed"
        }
      ],
      "phone_numbers": [
        {
          "primary": true,
          "number_type": "Mobile",
          "status": "unsubscribed"
        }
      ],
      "postal_addresses": [
        {
          "primary": true,
          "address_lines": [
            "1600 Pennsylvania Ave."
          ],
          "locality": "Washington",
          "region": "DC",
          "postal_code": "20009",
          "country": "US",
          "language": "en",
          "location": {
            "latitude": 38.919,
            "longitude": -77.0379,
            "accuracy": "Approximate"
          }
        }
      ],
      "languages_spoken": [
        "en"
      ],
      "_links": {
        "self": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
        },
        "osdi:attendances": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances"
        },
        "osdi:signatures": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures"
        },
        "osdi:submissions": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions"
        },
        "osdi:donations": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations"
        },
        "osdi:outreaches": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches"
        },
        "osdi:taggings": {
          "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
    },
    "osdi:signatures": {
      "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "osdi:creator": {
      "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
    },
    "action_network:embed": {
      "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/embed"
    },
    "record_signature_helper": {
      "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "curies": [
      {
        "name": "osdi",
        "href": "https://actionnetwork.org/docs/v2/{rel}",
        "templated": true
      },
      {
        "name": "action_network",
        "href": "https://actionnetwork.org/docs/v2/{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 API, 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/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/

Header:
OSDI-API-Token: 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/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures"
    },
    "osdi:signatures": [
      {
        "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
      },
      {
        "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/7567ff72-9a72-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": {
    "osdi:signatures": [
      {
        "identifiers": [
	      "action_network:779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
        ],
        "created_date": "2014-02-20T21:16:57Z",
        "modified_date": "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/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/779ad1e0-30c4-4c04-bc76-d49bf3d624ac"
          },
          "osdi:petition": {
            "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:person": {
            "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29"
          }
        }
      },
      {
        "identifiers": [
	      "action_network:7567ff72-9a72-11e3-a2e9-12313d316c29"
        ],
        "created_date": "2014-02-07T13:03:32Z",
        "modified_date": "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/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29/signatures/7567ff72-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:petition": {
            "href": "https://actionnetwork.org/api/v2/petitions/7580a324-9a72-11e3-a2e9-12313d316c29"
          },
          "osdi:person": {
            "href": "https://actionnetwork.org/api/v2/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.

Back To Top ↑

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