Tutorial: Unsubscribe People

Note: This documentation 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. Documentation for this tutorial for Version 2 of our API is available here.

This tutorial demonstrates how to unsubscribe people from your email list.

People who are unsubscribed will no longer be accessible to you via the API or the Action Network's user interface. Their action history will be deleted as well. They can be resubscribed if they take another action on pages you create, or if you add them via the API at a later date.

Steps:

Find a person to unsubscribe

The first step is to find the person you want to unsubscribe. You can do that by using the OData filtering system described in the general concepts documentation here.

In this case, we'll find the person by email address:

						
GET https://actionnetwork.org/api/v1/people/?filter=email_address eq 'jdoe@mail.com'

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": 1,
  "_links": {
    "osdi:people": [
      {
        "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-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
      }
    ],
    "self": {
      "href": "https://actionnetwork.org/api/v1/people"
    }
  },
  "_embedded": {
    "osdi:people": [
      {
        "given_name": "John",
        "family_name": "Doe",
        "identifiers": [
          "action_network:c947bcd0-929e-11e3-a2e9-12313d316c29"
        ],
        "created_at": "2014-02-21T17:49:59Z",
        "modified_at": "2014-02-21T17:49:59Z",
        "email_addresses": [
          {
            "primary": true,
            "address": "jdoe@mail.com"
          }
        ],
        "postal_addresses": [
          {
            "primary": true,
            "address_lines": [
              "1600 Pennsylvania Ave."
            ],
            "locality": "Washington",
            "region": "DC",
            "postal_code": "20009",
            "country": "US",
            "language": "en",
            "location": {
              "latitude": 32.349,
              "longitude": -75.6771,
              "accuracy": "Approximate"
            }
          }
        ],
        "_links": {
          "self": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29"
          },
          "osdi:question_answers": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29/question_answers"
          },
          "osdi:attendance": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29/attendance"
          },
          "osdi:signatures": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29/signatures"
          },
          "osdi:submissions": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29/submissions"
          },
          "osdi:donations": {
            "href": "https://actionnetwork.org/api/v1/people/c947bcd0-929e-11e3-a2e9-12313d316c29/donations"
          }
        }
      }
    ]
  }
}
					
Back To Top ↑

Unsubscribe the person

Once you have done your search and found your person, navigate to their individual record using the links provided and send a DELETE message to that individual URL, like so:

						
DELETE https://actionnetwork.org/api/v1/people/c947bcd0-929e-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


{
  "notice": "This user was successfully unsubscribed."
}
					

Click here for full documentation of people resources.

Back To Top ↑