NAV Navbar
shell ruby

Introduction

This API provides information about calls to action (CTAs). It uses the data modelling outlined in the Open Source Data Interface. All resources in the API are OSDI compliant.

The CTA Aggregator does deviate from OSDI when it comes to data presentation. Whereas the OSDI standard leverages HAL+JSON to repsesent resources, the CTAAggrategor uses the JSON API spec.
Feature like pagination, filtering, and CRUDing resrouces are all implemented following the conventions established in this spec.

The CTA Aggregator has two top-level resources: Events and Advocacy Campaigns. An event is a call to action that asks people to show up a particular location. An advocacy campaign is a call to action that requests that people send an email or make a phone call.

The API presents data in JSON. You can write consumers or scrapers in any language you want. If you’re working in Ruby, then you may want to leverage the Ruby gem, located here: https://github.com/RagtagOpen/cta-aggregator-client-ruby. This gem provides simple interface for reading and writing data from the API. It’s especially helpful for creating resoucres, since you can just pass it Ruby hashes and the gem will take care of constructing the JSON payload.

Authentication

Reading from the CTA Aggregator requires no authentication. However, if you want to create a resource, you will need to register your app and obtain a developer key and secret.

To get these, to send an email to ctaaggregator@ragtag.org.

Once you have these, you can obtain authentication tokens from the /authentications endpoint.

The CTA Aggregator API follows the JWT spec. For more information regarding this standard, consult RFC7519. The authentication flow for the cta-aggregator proceeds as follows:

Successful Authentication

To authenticate, use the following example. Make sure to replace api-key with your API key and api-secret with your API secret

# Set the api key and secret in the authorization header
curl -X POST "https://www.resistr.tech/v1/authentications"
  -H "AUTHORIZATION: api-key:api-secret"

The above command returns JSON structured like this:

  {
    "jwt": "xxxx.yyyy"
  }

Subsequent Authenticated Request:

# set the JWT in the authorization header
curl -X POST "https://www.resistr.tech/some-protected-endpoint"
  -H "AUTHORIZATION: Bearer xxxx.yyyy"

The above request should return a 200 status response if authentication is successful

Authentication starts with an api-key and an api-secret set in an authorization header as such:

Authorization: api-key:api-secret

If the server can successfully validate that the key and secret belong to a requesting user, it will respond with a 201, with a body containing a JWT token.

The returned token represents a sub claim which can be used to successfully authenticate a user. Setting that token to the HTTP_AUTHORIZATION header of subsequent requests will result in 200 level response.

Successful Authentication

NOTE: For security purposes, this API will only respond to https requests

Unsuccessful Authentication

curl -X POST "https://www.resistr.tech/v1/authentications"
  -H "AUTHORIZATION: wrong-api-key:or-secret"

The above command will return a 404 when the api key or secret is invalid

If the server cannot successfully validate that the key and secret belong to a requesting user, it will respond with a 404.

Unsuccessful Authentication

JWT Expiration

# set the JWT in the authorization header
curl -X POST "https://www.resistr.tech/some-protected-endpoint"
  -H "AUTHORIZATION: Bearer xxxx.yyyy"

The above command will return a 401 when the JWT has expired

All JWTs issued by the server will expire after 24 hours. When a token expires, subsequent requests using that token will result in a 401 response.

JWT Expires

Incorrect JWT Sent

# set a bad JWT in the authorization header
curl -X POST "https://www.resistr.tech/some-protected-endpoint"
  -H "AUTHORIZATION: Bearer abcd.efgh"

The above command will return a 401 when the JWT is incorrect.

An incorrect JWT will also result in a 401 response.

Bad JWT

Authorization

All resources currently obey the same authorization policy.

You can view anything without needing any authentication.

If you have API credentials, then you can create resources or update the resources you’ve created.

When updating a resource, you cannot make an update to a resource that was created by another contributor. The API will reject your request.

HTTP Method Authentication Required? Notes
Get No No authentication required to read any resource(s).
POST Yes Authentication required, but anyone with API credentials can create a resource.
PUT Yes Request will be accepted if you created the resource you are updating.
DELETE N/A Deleting a resource is not currently permitted. To get a resource removed, contact the Ragtag team at ctaaggregator@ragtag.org).

Events

An Event Resource is a top-level resource that represents a call to action that has a location.

It contains the following attributes.

Name Type Description
identifiers array A unique string array of identifiers in the format [system name]:[id].
start_date datetime The start time for the event.
end_date datetime date The date for all day events.
created_at datetime A read-only property representing the date and time the resource was created on the local system.
updated_at datetime A read-only property representing the date and time the resource was last modified on the local system.
title string The title of the event. Intended for public display rather than administrative purposes.
description string description of the event, usually displayed publicly. May contain text and/or HTML.
browser_url string A URL string pointing to the publicly available event page on the web.
origin_system string A human readable identifier of the system where this event was created. (ex: “OSDI System”)
featured_image_url string A URL string pointing to a publicly available featured image file for this event on the web.
free boolean Indicator of whether there is a cost associated with attending the event
location_id integer Identifier for location associated with event

For more information on OSDI’s Event resource, follow this link: https://opensupporter.github.io/osdi-docs/events.html.

Get All Future Events

curl -X GET "https://www.resistr.tech/v1/events"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

response = CTAAggregatorClient::Event.list
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": [
        {
            "id": "d9aa62d4-3d06-46d4-b855-d0a200b420ad",
            "type": "events",
            "links": {
                "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad"
            },
            "attributes": {
                "title": "Join EMILY's List President Stephanie Schriock for a special reception in Santa Fe!",
                "description": null,
                "browser_url": "https://secure.emilyslist.org/page/contribute/Events_Test",
                "origin_system": "Emily's List",
                "featured_image_url": null,
                "start_date": "2017-07-27T05:30:00.000Z",
                "end_date": null,
                "free": false,
                "identifiers": [
                    "emilys-list:Events_Test",
                    "cta-aggregator:d9aa62d4-3d06-46d4-b855-d0a200b420ad"
                ]
            },
            "relationships": {
                "location": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/relationships/location",
                        "related": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/location"
                    }
                },
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/relationships/user",
                        "related": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/user"
                    }
                }
            }
        },
        {
            "id": "3b511fd6-3057-46a0-9bac-e6c1633019ba",
            "type": "events",
            "links": {
                "self": "https://www.resistr.tech/v1/events/3b511fd6-3057-46a0-9bac-e6c1633019ba"
            },
            "attributes": {
                "title": "Join EMILY's List President Stephanie Schriock and featured speakers Senator Kirsten Gillibrand and Rep. Jacky Rosen at our Ignite Change Luncheon in New York!",
                "description": null,
                "browser_url": "https://secure.emilyslist.org/page/contribute/NYC_Ignite_Change_Luncheon",
                "origin_system": "Emily's List",
                "featured_image_url": null,
                "start_date": "2017-09-18T12:00:00.000Z",
                "end_date": null,
                "free": false,
                "identifiers": [
                    "emilys-list:NYC_Ignite_Change_Luncheon",
                    "cta-aggregator:3b511fd6-3057-46a0-9bac-e6c1633019ba"
                ]
            },
            "relationships": {
                "location": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/3b511fd6-3057-46a0-9bac-e6c1633019ba/relationships/location",
                        "related": "https://www.resistr.tech/v1/events/3b511fd6-3057-46a0-9bac-e6c1633019ba/location"
                    }
                },
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/3b511fd6-3057-46a0-9bac-e6c1633019ba/relationships/user",
                        "related": "https://www.resistr.tech/v1/events/3b511fd6-3057-46a0-9bac-e6c1633019ba/user"
                    }
                }
            }
        },
        {
            "id": "b0e86149-c781-417e-a96f-1a57c3ed863b",
            "type": "events",
            "links": {
                "self": "https://www.resistr.tech/v1/events/b0e86149-c781-417e-a96f-1a57c3ed863b"
            },
            "attributes": {
                "title": "Join EMILY's List President Stephanie Schriock and special guest Congresswoman Jacky Rosen at our 2017 Ignite Change Luncheon in San Francisco!",
                "description": null,
                "browser_url": "https://secure.emilyslist.org/page/contribute/western-regional-luncheon",
                "origin_system": "Emily's List",
                "featured_image_url": null,
                "start_date": "2017-10-13T11:00:00.000Z",
                "end_date": null,
                "free": false,
                "identifiers": [
                    "emilys-list:western-regional-luncheon",
                    "cta-aggregator:b0e86149-c781-417e-a96f-1a57c3ed863b"
                ]
            },
            "relationships": {
                "location": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/b0e86149-c781-417e-a96f-1a57c3ed863b/relationships/location",
                        "related": "https://www.resistr.tech/v1/events/b0e86149-c781-417e-a96f-1a57c3ed863b/location"
                    }
                },
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/events/b0e86149-c781-417e-a96f-1a57c3ed863b/relationships/user",
                        "related": "https://www.resistr.tech/v1/events/b0e86149-c781-417e-a96f-1a57c3ed863b/user"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://www.resistr.tech/v1/events?page%5Bnumber%5D=1&page%5Bsize%5D=10",
        "last": "https://www.resistr.tech/v1/events?page%5Bnumber%5D=1&page%5Bsize%5D=10"
    }
}

This endpoint retrieves all future events.

HTTP Request

GET https://www.resistr.tech/v1/events

Filter

You can filter based on the following attributes

Filter Values Description Example
past true filter by events in the past GET "https://www.resistr.tech/v1/events?filter[past]=true"
free true, false filter by free events GET "https://www.resistr.tech/v1/events?filter[free]=true"
origin_system 5calls, etc filter by origin_system GET "https://www.resistr.tech/v1/events?filter[origin_system]=5calls"

Get a Specific Event

curl -X GET  "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

uuid = 'd9aa62d4-3d06-46d4-b855-d0a200b420ad'
response = CTAAggregatorClient::Event.find(uuid)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "d9aa62d4-3d06-46d4-b855-d0a200b420ad",
        "type": "events",
        "links": {
            "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad"
        },
        "attributes": {
            "title": "Join EMILY's List President Stephanie Schriock for a special reception in Santa Fe!",
            "description": null,
            "browser_url": "https://secure.emilyslist.org/page/contribute/Events_Test",
            "origin_system": "Emily's List",
            "featured_image_url": null,
            "start_date": "2017-07-27T05:30:00.000Z",
            "end_date": null,
            "free": false,
            "identifiers": [
                "emilys-list:Events_Test",
                "cta-aggregator:d9aa62d4-3d06-46d4-b855-d0a200b420ad"
            ]
        },
        "relationships": {
            "location": {
                "links": {
                    "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/relationships/location",
                    "related": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/location"
                }
            },
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/relationships/user",
                    "related": "https://www.resistr.tech/v1/events/d9aa62d4-3d06-46d4-b855-d0a200b420ad/user"
                }
            }
        }
    }
}

This endpoint retrieves a specific event.

HTTP Request

GET "https://www.resistr.tech/v1/events/<UUID>

URL Parameters

Parameter Description
ID The ID of the event to retrieve

Create an Event

curl -X POST "https://www.resistr.tech/v1/events"
  -H "Content-Type: application/vnd.api+json"
  -H "Accept: application/vnd.api+json"
  -H "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1MDI2NjMwMjEsInN1YiI6ImI0ZDQ5MDAzLWEyMWYtNGVjZi1hYjM3LTQzMmRkMWM4MzE4MiJ9.Q_QeKrpgvelRZ-XB8gM1B1SSrjeGVEK93HLW2p4SoFJv5zICQV6aFiKyA1lJ8qhrPBzqIPtTgqQBTN9ng0c0PA"
  -d ' {
    "data": {
        "type": "events",
        "attributes": {
            "title": "Sitin at city hall",
            "description": null,
            "browser_url": "https://secure.emilyslist.org/page/contribute/cityhallsitin",
            "origin_system": "emilyslist",
            "featured_image_url": null,
            "start_date": "2017-07-27T00:00:00.000Z",
            "end_date": null,
            "free": false,
            "identifiers": ["emilyslist:cityhallsitin"]
        },
        "relationships": {
            "location": {
                "data": {
                    "type": "locations",
                    "id": "cf2e490a-7bed-46d5-8e0a-386dfb365cc8"
                }
            }
        }
    }
} '
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

event_attrs = {
  title: 'March on Washington',
  description: 'Illum molestiae aut ullam non qui consequatur magni.',
  browser_url: 'http://example.com/marge',
  origin_system: '5Calls',
  featured_image_url: 'http://lorempixel.com/300/300',
  start_date: '2017-07-08T03:58:25.098Z',
  end_date: '2017-07-13T03:58:25.098Z',
  free: false,
  location: '215ed993-3cd1-4fbc-b8af-7e2082813d06'
}

CTAAggregatorClient::Event.create(event_attrs)

The above command returns JSON structured like this:

{
    "data": {
        "id": "6ef4013f-e016-4ca0-bb28-d2d3e39286d6",
        "type": "events",
        "links": {
            "self": "https://www.resistr.tech/v1/events/6ef4013f-e016-4ca0-bb28-d2d3e39286d6"
        },
        "attributes": {
            "title": "Sit in at city hall",
            "description": null,
            "browser_url": "https://secure.emilyslist.org/page/contribute/cityhallsitin",
            "origin_system": "emilyslist:cityhallsitin",
            "featured_image_url": null,
            "start_date": "2017-07-27T00:00:00.000Z",
            "end_date": null,
            "free": false,
            "identifiers": ["emilyslist:cityhallsitin", "cta-aggregator:6ef4013f-e016-4ca0-bb28-d2d3e39286d6" ]
        },
        "relationships": {
            "location": {
                "links": {
                    "self": "https://www.resistr.tech/v1/events/6ef4013f-e016-4ca0-bb28-d2d3e39286d6/relationships/location",
                    "related": "https://www.resistr.tech/v1/events/6ef4013f-e016-4ca0-bb28-d2d3e39286d6/location"
                }
            },
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/events/6ef4013f-e016-4ca0-bb28-d2d3e39286d6/relationships/user",
                    "related": "https://www.resistr.tech/v1/events/6ef4013f-e016-4ca0-bb28-d2d3e39286d6/user"
                }
            }
        }
    }
}

This endpoint creates a new event.

HTTP Request

POST "https://www.resistr.tech/v1/events/"

Requests to create a resource must include a valid JWT token. This token can be obtained from the authentication endpoint.

Locations

A Location resource is a sub-resource related to an Event. Each Event has one Location. Every Location resource contains the following attributes.

Name Type Description
venue string Optional venue name at the event address, useful for names of buildings. (ex: Smith Hall)
address_lines array An array of strings representing the event’s street address.
locality string A city or other local administrative area.
region string State or subdivision codes according to ISO 3166-2 (Final 2 alpha digits).
postal_code string The region specific postal code, such as a zip code.

For more information on OSDI’s Location resource, follow this link: https://opensupporter.github.io/osdi-docs/events.html#location.

Get All Locations

curl -X GET  "https://www.resistr.tech/v1/locations"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

response = CTAAggregatorClient::Location.list
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": [
        {
            "id": "cf2e490a-7bed-46d5-8e0a-386dfb365cc8",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8"
            },
            "attributes": {
                "venue": null,
                "address_lines": null,
                "locality": "Santa Fe",
                "region": "NM",
                "postal_code": null
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8/user"
                    }
                }
            }
        },
        {
            "id": "dca1fc5b-a26b-4a7e-809a-26d8417921c8",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/dca1fc5b-a26b-4a7e-809a-26d8417921c8"
            },
            "attributes": {
                "venue": null,
                "address_lines": null,
                "locality": "New York",
                "region": "NY",
                "postal_code": null
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/dca1fc5b-a26b-4a7e-809a-26d8417921c8/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/dca1fc5b-a26b-4a7e-809a-26d8417921c8/user"
                    }
                }
            }
        },
        {
            "id": "2bd08fff-2154-4eaf-8a05-b014f462fa1e",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/2bd08fff-2154-4eaf-8a05-b014f462fa1e"
            },
            "attributes": {
                "venue": null,
                "address_lines": null,
                "locality": "San Francisco",
                "region": "CA",
                "postal_code": null
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/2bd08fff-2154-4eaf-8a05-b014f462fa1e/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/2bd08fff-2154-4eaf-8a05-b014f462fa1e/user"
                    }
                }
            }
        },
        {
            "id": "58ad3adb-7cb5-4851-99e4-e9e3f7f6aee1",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/58ad3adb-7cb5-4851-99e4-e9e3f7f6aee1"
            },
            "attributes": {
                "venue": null,
                "address_lines": "3845 S Capitol St SW",
                "locality": "Washington",
                "region": "DC",
                "postal_code": "20032"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/58ad3adb-7cb5-4851-99e4-e9e3f7f6aee1/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/58ad3adb-7cb5-4851-99e4-e9e3f7f6aee1/user"
                    }
                }
            }
        },
        {
            "id": "45edada9-947f-4c00-922f-9aaffe0f23a7",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/45edada9-947f-4c00-922f-9aaffe0f23a7"
            },
            "attributes": {
                "venue": null,
                "address_lines": "201 Railroad St N",
                "locality": "Ridgway",
                "region": "CO",
                "postal_code": "81432"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/45edada9-947f-4c00-922f-9aaffe0f23a7/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/45edada9-947f-4c00-922f-9aaffe0f23a7/user"
                    }
                }
            }
        },
        {
            "id": "5539972b-9ea8-4c24-8718-4b9c3221a8c8",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/5539972b-9ea8-4c24-8718-4b9c3221a8c8"
            },
            "attributes": {
                "venue": null,
                "address_lines": "Dr Holly Hale Center, 135 Harrison Avenue, Panama City, FL 32405",
                "locality": "Panama City",
                "region": "FL",
                "postal_code": "32401"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/5539972b-9ea8-4c24-8718-4b9c3221a8c8/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/5539972b-9ea8-4c24-8718-4b9c3221a8c8/user"
                    }
                }
            }
        },
        {
            "id": "f2765cdc-c4c8-469d-bc2f-93533e655acd",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/f2765cdc-c4c8-469d-bc2f-93533e655acd"
            },
            "attributes": {
                "venue": null,
                "address_lines": "12861 N 8th Ave",
                "locality": "Phoenix",
                "region": "AZ",
                "postal_code": "85029"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/f2765cdc-c4c8-469d-bc2f-93533e655acd/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/f2765cdc-c4c8-469d-bc2f-93533e655acd/user"
                    }
                }
            }
        },
        {
            "id": "954de3db-ef9e-4ed5-8809-d3fbd5bb168d",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/954de3db-ef9e-4ed5-8809-d3fbd5bb168d"
            },
            "attributes": {
                "venue": null,
                "address_lines": [],
                "locality": "Minneapolis",
                "region": "MN",
                "postal_code": "55435"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/954de3db-ef9e-4ed5-8809-d3fbd5bb168d/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/954de3db-ef9e-4ed5-8809-d3fbd5bb168d/user"
                    }
                }
            }
        },
        {
            "id": "f050ccea-acfd-48d1-a7e2-792773e853a5",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/f050ccea-acfd-48d1-a7e2-792773e853a5"
            },
            "attributes": {
                "venue": null,
                "address_lines": "1700 South Broad Street",
                "locality": "Philadelphia",
                "region": "PA",
                "postal_code": "19145"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/f050ccea-acfd-48d1-a7e2-792773e853a5/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/f050ccea-acfd-48d1-a7e2-792773e853a5/user"
                    }
                }
            }
        },
        {
            "id": "9c7b641b-2feb-48a3-b16c-4c1be029d440",
            "type": "locations",
            "links": {
                "self": "https://www.resistr.tech/v1/locations/9c7b641b-2feb-48a3-b16c-4c1be029d440"
            },
            "attributes": {
                "venue": null,
                "address_lines": "60  Lake St",
                "locality": "Burlington",
                "region": "VT",
                "postal_code": "05401"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/locations/9c7b641b-2feb-48a3-b16c-4c1be029d440/relationships/user",
                        "related": "https://www.resistr.tech/v1/locations/9c7b641b-2feb-48a3-b16c-4c1be029d440/user"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://www.resistr.tech/v1/locations?page%5Bnumber%5D=1&page%5Bsize%5D=10",
        "next": "https://www.resistr.tech/v1/locations?page%5Bnumber%5D=2&page%5Bsize%5D=10",
        "last": "https://www.resistr.tech/v1/locations?page%5Bnumber%5D=3&page%5Bsize%5D=10"
    }
}

This endpoint retrieves all locations.

HTTP Request

GET https://www.resistr.tech/v1/locations

Filter

You can filter based on the attributes below.

Filter Example
locality GET "https://www.resistr.tech/v1/locations?filter[locality]=Detroit"
region GET "https://www.resistr.tech/v1/locations?filter[region]=ID"
postal_code GET "https://www.resistr.tech/v1/locations?filter[postal_code]=66001"

Get a Specific Location

curl -X GET  "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

uuid = 'cf2e490a-7bed-46d5-8e0a-386dfb365cc8'
response = CTAAggregatorClient::Location.find(uuid)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "cf2e490a-7bed-46d5-8e0a-386dfb365cc8",
        "type": "locations",
        "links": {
            "self": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8"
        },
        "attributes": {
            "venue": "Riverfront park",
            "address_lines": '123 Fake Street',
            "locality": "Santa Fe",
            "region": "NM",
            "postal_code": "87501"
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8/relationships/user",
                    "related": "https://www.resistr.tech/v1/locations/cf2e490a-7bed-46d5-8e0a-386dfb365cc8/user"
                }
            }
        }
    }
}

This endpoint retrieves a specific Location.

HTTP Request

GET "https://www.resistr.tech/v1/locations/<UUID>

URL Parameters

Parameter Description
ID The ID of the location to retrieve

Create a Location

curl -X POST "https://www.resistr.tech/v1/locations"
  -H "Content-Type: application/vnd.api+json" 
  -H "Accept: application/vnd.api+json" 
  -H "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1MDI2NjMwMjEsInN1YiI6ImI0ZDQ5MDAzLWEyMWYtNGVjZi1hYjM3LTQzMmRkMWM4MzE4MiJ9.Q_QeKrpgvelRZ-XB8gM1B1SSrjeGVEK93HLW2p4SoFJv5zICQV6aFiKyA1lJ8qhrPBzqIPtTgqQBTN9ng0c0PA"
  -d ' {
    "data": {
        "type": "locations",
        "attributes": {
            "venue": "Moe's Cantina",
            "address_lines": "123 Fake Street",
            "locality": "Santa Fe",
            "region": "NM",
            "postal_code": 87501
        }
    }
} '
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)


location_attrs = {
  venue: 'Eastern Kemmer University',
  address_lines: ['684 Schinner Trail', 'Apt. 512'],
  locality: 'Rosenbaumville',
  region: 'VA',
  postal_code: '78183-3430'
}
response = CTAAggregatorClient::Location.create(location_attrs)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "a728f38a-623c-4342-aa89-7ab39fd83c35",
        "type": "locations",
        "links": {
            "self": "https://www.resistr.tech/v1/locations/a728f38a-623c-4342-aa89-7ab39fd83c35"
        },
        "attributes": {
            "venue": "Moe's Cantina",
            "address_lines": "123 Fake Street",
            "locality": "Santa Fe",
            "region": "NM",
            "postal_code": "87501"
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/locations/a728f38a-623c-4342-aa89-7ab39fd83c35/relationships/user",
                    "related": "https://www.resistr.tech/v1/locations/a728f38a-623c-4342-aa89-7ab39fd83c35/user"
                }
            }
        }
    }
}

This endpoint creates a Location.

HTTP Request

POST "https://www.resistr.tech/v1/locations"

Requests to create a resource must include a valid JWT token. This token can be obtained from the authentication endpoint.

Advocacy Campaigns

An Advocacy Campaign resource is a top-level resource that represents a call to action that involves reaching out via email, in-person, phone, postal, or social-media.

It contains the following attributes.

Name Type Description
identifiers array A unique string array of identifiers in the format [system name]:[id].
created_at datetime A read-only property representing the date and time the resource was created on the local system.
updated_at datetime A read-only property representing the date and time the resource was last modified on the local system.
origin_system string A human readable identifier of the system where this advocacy campaign was created. (ex: “OSDI System”)
title string The title of the advocacy campaign. Intended for public display rather than administrative purposes.
description string A description of the advocacy campaign, usually displayed publicly. May contain text and/or HTML.
template string A script to read over the phone, or a general template for a postcard or email. These may be captured in the description, but putting it in the templates field allows it to be highlighted by clients. May contain text and/or HTML.
browser_url string A URL string pointing to the publicly available advocacy campaign page on the web.
featured_image_url string A URL string pointing to a publicly available featured image file for this advocacy campaign on the web.
action_type string The type of advocacy campaign, specifying how users perform outreaches to targets. Options: “email”, “in-person”, “phone”, “postal”, “social-media”
target_list string An array of target object hashes representing the targets of the advocacy campaign.

For more information on OSDI’s Advocacy Campaign resource, follow this link: https://opensupporter.github.io/osdi-docs/advocacy_campaigns.html.

Get All Advocacy Campaigns

curl -X GET "https://www.resistr.tech/v1/advocacy_campaigns"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

response = CTAAggregatorClient::AdvocacyCampaign.list
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": [
        {
            "id": "3c29ff31-d859-42fd-a786-c69306eadb86",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86"
            },
            "attributes": {
                "title": "Express Outrage at Open White Supremacy Rally in Charlottesville",
                "description": "Update (8/12): The 'Unite The Right' rally has turned violent after a car intentionally drove into a group of counter-protestors, leaving one dead and 19 others injured. We must stand up against this violence and hate.\n\nOn August 11th in Charlottesville, Virginia, a group of white protesters (mostly men) marched through the University of Virginia campus carrying torches and chanting “White Lives Matter” and “Jews Will Not Replace Us.\" As disturbing as this modern day KKK rally was, it was only a preview of the next day’s larger event in Emancipation Park: the \"Unite the Right” rally and march. No longer expecting consequences, these extremists did not bother to conceal their faces behind white hoods as in years past. Instead, they proudly raised their hands in Nazi salutes and used other anti-LGBT, anti-black, anti-Muslim chants and symbols. Attended by openly racist leaders like David Duke and Richard Spencer, there were multiple skirmishes between those carrying Nazi and Confederate flags and those counter protestings. Millions around the nation and world watch as American society is pummeled yet again by the destructive forces of hate.\n\nAlthough speech of all kinds is protected by the 1st Amendment, that protection does not require silence on the part of those who disagree. The American people need and deserve leadership that affirms the values of acceptance and inclusion that our country was founded upon and that we have struggled to extend to all people over the past 240+ years. The American people deserve leaders that stand up to hate and promote unity at a time when our President employs multiple openly racist advisors like Sebastian Gorka, Steven Miller, Steven Bannon, and appointed Jeff Sessions as Attorney General. Both the Governor of Virginia and Mayor of Charlottesville were quick to denounce these gatherings, as were some other members of Congress, but Trump only tweeted 3 vague and generic sentences about unspecified \"hate.\" All elected officials in our government must join what should be a deafening chorus of denunciation against this kind of racist and hate-fueled speech.",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to express my outrage about the ugly demonstrations in Charlottesville. I demand that [REP/SEN NAME] join [his/her] colleagues on both sides of the aisle in denouncing the 'Unite the Right' white supremacist rally in Charlottesville. Protecting free speech does not equate to silence on matters of racism, hate, and violence.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:reco1LA9EU4aQeoLu",
                    "cta-aggregator:3c29ff31-d859-42fd-a786-c69306eadb86"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/target_list"
                    }
                }
            }
        },
        {
            "id": "8cd8e9ac-f684-4cdf-8e67-60c40e386eff",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff"
            },
            "attributes": {
                "title": " Demand the Removal of Bannon, Gorka, and Miller from the White House",
                "description": "The tragic events in Charlottesville on Saturday, August 12th rocked the United States to the core. As famed racist David Duke proclaimed that the purpose of the event was to “fulfill the promises of Donald Trump” and to “take our country back,\" white supremacists and neo-Nazis rallied and attacked counter protesters. James Alex Fields is now charged with 2nd-degree murder for ramming his car into a group of protesters, killing Heather Heyer, a 32 year old anti-racist protester.  \n\nIn times of hatred-fueled turmoil, Americans should be able to depend on the President to reaffirm American values of justice, fairness, and equality for all. Instead, after hours of silence, Donald Trump falsely equated white supremacists carrying Confederate and Nazi flags while chanting \"Heil Trump\" with the counter protesters defending civil rights. Although the White House has issued a clarification that their denunciation “includes white supremacists, KKK and all extremist groups”, this too little, too late, and still too weak approach leaves Americans wondering if their President actually supported these actions.\n\nThis massive failure of leadership should not come as a surprise to anyone since Donald Trump has at least 3 White House advisors who support white supremacist ideologies: Steven Bannon, Sebastian Gorka, and Steven Miller. Each man has a history of either promoting their own racist views or amplifying the views of other extremists.\n\nThe White House needs to cut ties to these three divisive figures to show the nation and the world that the President does not endorse racism, white supremacy, the KKK or Nazism. It is now time for Congress to call for their resignation so we can begin to heal from the damage that has been done.",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to demand that [REP/SEN NAME] call for the resignation of Steve Bannon, Sebastian Gorka and Stephen Miller. These three men have histories of extremist ideologies and should not be working in the White House. The American people deserve a Presidential administration that has no ties to racism, the KKK, white supremacy, or Nazis.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:recBJObrOidVQMIoY",
                    "cta-aggregator:8cd8e9ac-f684-4cdf-8e67-60c40e386eff"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8cd8e9ac-f684-4cdf-8e67-60c40e386eff/target_list"
                    }
                }
            }
        },
        {
            "id": "e895f3c4-d4f4-47fe-aeaa-1f4745287d04",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04"
            },
            "attributes": {
                "title": "Prevent Military Action Against North Korea",
                "description": "The escalating tensions with North Korea have taken a sudden and dangerous turn, with the Washington Post reporting the isolated country has successfully produced a miniaturized nuclear warhead that will fit inside a ballistic missile. Trump responded to the report with alarming rhetoric, stating North Korea will be “met with fire and fury” if they were to make any threats against the United States. Not surprisingly, a few short hours later North Korea responded with threats of missile strikes on Guam, a U.S. territory in the Western Pacific Ocean.\n\nBombs and attacks are not always the answer to global crises, and we must not stumble into another nuclear war and risk innocent lives in the process. The president has yet to explore diplomacy and non-military options, and instead has only made threats of force and aggression. As a co-equal branch of government and an important check on the President's power, Congress must be consulted before any further actions take place that endanger the lives of Americans. \n\nTrump should follow the same procedure as all other US Presidents and seek the approval of Congress before any military action takes place in North Korea, or any other location in the world.",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I'm a constituent from [CITY, ZIP]. \n\nI'm calling to urge [SENATOR/REP NAME] to demand congressional approval before any military engagement takes place in North Korea and to vote against any request to do so. We cannot and should not stumble into another unnecessary war. Thank you for your time and attention. \n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:recP3XRP4IFDvaCgF",
                    "cta-aggregator:e895f3c4-d4f4-47fe-aeaa-1f4745287d04"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/e895f3c4-d4f4-47fe-aeaa-1f4745287d04/target_list"
                    }
                }
            }
        },
        {
            "id": "8a09df4c-cc63-47f8-a723-9f9b2886e83c",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c"
            },
            "attributes": {
                "title": "Support the College for All Act   ",
                "description": "Thanks to skyrocketing college tuition costs, student debt in the US amounts to $1.3 trillion. Eighty-three percent of all students attending US public universities graduate with debt, and some of them will remain in debt for their entire lives. \n\nA coalition of Representatives and Senators have introduced a bill to end the crushing burden of high college tuition. The College for All Act would provide free public university tuition for families earning up to $125,000 per year, covering about 80% of all US college students. The bill would also reduce student loan interest rates for new borrowers, allow existing borrowers to refinance at lower rates, and eliminate tuitions and fees at two-year community colleges. \n\nStudent loan debt prevents people from buying homes, starting families, saving for retirement, and working in lower-paying but crucial fields like social work and early childhood education. It is time to end the student debt crisis and make an affordable college education a reality for all.     ",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I'm a constituent from [CITY, ZIP]. \n\n[IF COMMITTEE]: I'm calling to ask the committee to schedule a hearing for [HR 1880/S 806], the College for All Act. This important bill would alleviate the economic and social burden of student debt and give everyone access to an affordable college education.\n\n[IF REP/SEN]: I'm calling to ask [REP/SEN NAME] to support [HR 1880/S 806], the College for All Act. This important bill would alleviate the economic and social burden of student debt and give everyone access to an affordable college education.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]        ",
                "target_list": [
                    {
                        "id": "360cda45-6d93-42ae-a0fb-e1f6ebdba564",
                        "organization": "Senate Committee on Health",
                        "given_name": null,
                        "family_name": null,
                        "ocdid": null,
                        "postal_addresses": [],
                        "email_addresses": [],
                        "phone_numbers": [
                            {
                                "primary": true,
                                "number": "202-224-5375",
                                "number_type": "work"
                            }
                        ],
                        "created_at": "2017-08-13 03:33:12 UTC",
                        "updated_at": "2017-08-13 03:33:12 UTC",
                        "user_id": "b4d49003-a21f-4ecf-ab37-432dd1c83182",
                        "title": null
                    },
                    {
                        "id": "b92ff013-174d-4767-8892-645898cc5778",
                        "organization": "House Committee on Education and the Workforce",
                        "given_name": null,
                        "family_name": null,
                        "ocdid": null,
                        "postal_addresses": [],
                        "email_addresses": [],
                        "phone_numbers": [
                            {
                                "primary": true,
                                "number": "202-225-4527",
                                "number_type": "work"
                            }
                        ],
                        "created_at": "2017-08-13 03:33:12 UTC",
                        "updated_at": "2017-08-13 03:33:12 UTC",
                        "user_id": "b4d49003-a21f-4ecf-ab37-432dd1c83182",
                        "title": null
                    }
                ],
                "identifiers": [
                    "5Calls:reclk123ddZOOdyp1",
                    "cta-aggregator:8a09df4c-cc63-47f8-a723-9f9b2886e83c"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/8a09df4c-cc63-47f8-a723-9f9b2886e83c/target_list"
                    }
                }
            }
        },
        {
            "id": "884ebdeb-5980-465e-bfd5-c0011240230d",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d"
            },
            "attributes": {
                "title": "Protect Voting Rights with 2020 Census Funding",
                "description": "The information gathered during the 2020 Census will be used to inform state redistricting efforts, allocate seats within the House of Representatives, and provide demographic information to inform policy decisions at all levels of government. However, the House and Senate Appropriations Committees have not provided sufficient funds to adequately prepare for the 2020 Census. \n\nAn accurate census count is essential to ensure traditionally under-counted groups, like Latinx, Black, low-income, and non-English-speaking households, are adequately documented. The Census Bureau reported missing 2.1% of Black Americans and 1.5% of Latinx Americans in its 2010 count, while overcounting non-Latinx White Americans by 0.84%. Without robust and accurate data, the 2020 Census could be used to weaken the voting power of voters of color via partisan gerrymandering and systematically under-fund jurisdictions with larger proportions of non-White residents.\n\nA well-supported and well-funded 2020 Census is critical to the integrity of our democracy. The 2018 Commerce, Justice, and Science Appropriations bills (H.R.3267 / S.1662) have passed both House and Senate Committees with insufficient funding levels for the Census Bureau (about $300 million below requested amount). They now go to the full chambers for further debate and votes.",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI’m calling today because I’m very concerned about the lack of adequate funding for the 2020 Census Bureau. I ask that [REP/SEN NAME] work to pass a 2018 spending bill that gives the bureau its requested funding levels so that it can ensure a fair and accurate 2020 Census.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:recDcn4wSNH9gBaBR",
                    "cta-aggregator:884ebdeb-5980-465e-bfd5-c0011240230d"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/884ebdeb-5980-465e-bfd5-c0011240230d/target_list"
                    }
                }
            }
        },
        {
            "id": "6722e7a2-79e2-483e-b210-6a2ed68a79a1",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1"
            },
            "attributes": {
                "title": "Oppose the RAISE Act's Attack on Legal Immigration",
                "description": "The RAISE Act, legislation to reduce the amount of legal immigration in the US by switching to a \"merit-based\" system, was introduced by Senators Tom Cotton (R-AR) and David Perdue (R-GA) in February of 2017, but failed to receive much support from other Republicans due to the bill's extreme nature. Republican Senators John McCain, Lindsey Graham, and Tim Scott have already voiced concerns with the RAISE Act. However, Trump threw his weight behind the bill with a press event on August 2nd, when he expressed support for the drastic reduction in legal immigration the RAISE Act would bring (50% by 2027).\n\nThe claimed purpose of the RAISE Act is the reduce the flow of low-skilled legal immigrants by favoring applicants based on skills, education, and ability to speak English, in order to increase wages for American workers. However, economists have debunked this idea: in reality, immigrants help the economy grow, creating higher-skilled, higher-paying jobs for native-born Americans. The Cato Institute, a libertarian think tank, studied the RAISE Act and concluded that its enactment would case a *reduction* in wages across all skill levels. In addition to its adverse economic affects, the bill would also cap refugee admissions, eliminate the diversity visa program, and tear families apart with drastic cuts to visas for immigrant family members.\n\nThe White House's endorsement of the RAISE Act serves as a way to ignite the anti-immigration voters in Trump's base, and is an attempt by Senators Cotton and Perdue to gain more momentum to pass their bill. With a myriad of other priorities backlogged in the Senate - tax cuts, the 2018 budget, the debt ceiling - the RAISE Act has a lot of heavy lifting to do in order to pass the chamber. ",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to urge [REP/SEN NAME] to oppose S.354, the RAISE Act. This bill's drastic reduction to legal immigration goes against not only our country's values, but our economy as well.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:recAgtK5jJM2nsgCO",
                    "cta-aggregator:6722e7a2-79e2-483e-b210-6a2ed68a79a1"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/6722e7a2-79e2-483e-b210-6a2ed68a79a1/target_list"
                    }
                }
            }
        },
        {
            "id": "32cd480a-0d71-446f-a4d1-3ebcb1cdbf30",
            "type": "advocacy_campaigns",
            "links": {
                "self": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30"
            },
            "attributes": {
                "title": "Demand Fair Tax Reform ",
                "description": "After losing their first major legislative battle and failing to repeal the ACA, Congressional Republicans are now shifting focus to tax reform. However, tax \"reform\" may not be an accurate description, as the majority of what has been discussed so far consists of tax cuts to corporations and the wealthiest Americans, and little to no benefits for the middle and working classes. \n\nThe Republican tax plan would cut the corporate tax rate from 35% to 15% and eliminate the alternative minimum tax (AMT), changes that would disproportionately benefit wealthy Americans and allow them to exploit tax code loopholes. Trump's 2005 tax return revealed that without the AMT, he would have paid a tax rate of only 3.5%. The Republican tax plan also proposes to eliminate the estate tax, a tax that only applies to the wealthiest 0.2% of American families, such as the Trump family. \n\nSince Republicans plan to use the budget reconciliation process to push a partisan tax bill through Congress, the bill is not allowed to add to the federal deficit. This means that the new tax cuts for corporations or the wealthy will be budget-neutralized by cutting spending on programs that benefit working class families, such as Medicaid, Medicare, and Social Security. Minority Leader Chuck Schumer (D-NY) sent a letter signed by nearly all members of the Democratic caucus to Majority Leader Mitch McConnell (R-KY), stating that the Democrats are willing to work with Republicans on a tax plan that does not cut taxes for the top 1% or cut spending on vital social safety net programs. Our representatives in Congress must work together towards federal tax reforms that will treat all Americans fairly.",
                "browser_url": null,
                "origin_system": "5Calls",
                "featured_image_url": null,
                "action_type": "phone",
                "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling because I am opposed to any partisan tax plan that cuts taxes for corporations and the wealthy at the expense of Medicare, Social Security, and other social programs that working-class Americans depend on. I expect [REP/SEN NAME] to work towards fair tax reform by following regular order, through committee hearings and bipartisan contributions.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
                "target_list": [],
                "identifiers": [
                    "5Calls:recBPOngPfTX1kVFU",
                    "cta-aggregator:32cd480a-0d71-446f-a4d1-3ebcb1cdbf30"
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/relationships/user",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/user"
                    }
                },
                "targets": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/relationships/targets",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/targets"
                    }
                },
                "target_list": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/relationships/target_list",
                        "related": "https://www.resistr.tech/v1/advocacy_campaigns/32cd480a-0d71-446f-a4d1-3ebcb1cdbf30/target_list"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://www.resistr.tech/v1/advocacy_campaigns?page%5Bnumber%5D=1&page%5Bsize%5D=10",
        "next": "https://www.resistr.tech/v1/advocacy_campaigns?page%5Bnumber%5D=2&page%5Bsize%5D=10",
        "last": "https://www.resistr.tech/v1/advocacy_campaigns?page%5Bnumber%5D=2&page%5Bsize%5D=10"
    }
}

This endpoint retrieves all advocacy campaigns.

HTTP Request

GET https://www.resistr.tech/v1/advocacy_campaigns

Filter

You can filter based on the following attributes

Filter Values Description Example
action_type email, in-person, phone, postal, social-media action type for advocacy campaign https://www.resistr.tech/v1/advocacy_campaigns?filter[advocacy_campaign_type]=phone
origin_system 5calls, Resistance Calendar, etc filter by free events https://www.resistr.tech/v1/advocacy_campaigns?filter[origin_system]=5calls

Get a Specific Advocacy Campaign

curl -X GET  "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

uuid = '3c29ff31-d859-42fd-a786-c69306eadb86'
response = CTAAggregatorClient::AdvocacyCampaign.find(uuid)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "3c29ff31-d859-42fd-a786-c69306eadb86",
        "type": "advocacy_campaigns",
        "links": {
            "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86"
        },
        "attributes": {
            "title": "Express Outrage at Open White Supremacy Rally in Charlottesville",
            "description": "Update (8/12): The 'Unite The Right' rally has turned violent after a car intentionally drove into a group of counter-protestors, leaving one dead and 19 others injured. We must stand up against this violence and hate.\n\nOn August 11th in Charlottesville, Virginia, a group of white protesters (mostly men) marched through the University of Virginia campus carrying torches and chanting “White Lives Matter” and “Jews Will Not Replace Us.\" As disturbing as this modern day KKK rally was, it was only a preview of the next day’s larger event in Emancipation Park: the \"Unite the Right” rally and march. No longer expecting consequences, these extremists did not bother to conceal their faces behind white hoods as in years past. Instead, they proudly raised their hands in Nazi salutes and used other anti-LGBT, anti-black, anti-Muslim chants and symbols. Attended by openly racist leaders like David Duke and Richard Spencer, there were multiple skirmishes between those carrying Nazi and Confederate flags and those counter protestings. Millions around the nation and world watch as American society is pummeled yet again by the destructive forces of hate.\n\nAlthough speech of all kinds is protected by the 1st Amendment, that protection does not require silence on the part of those who disagree. The American people need and deserve leadership that affirms the values of acceptance and inclusion that our country was founded upon and that we have struggled to extend to all people over the past 240+ years. The American people deserve leaders that stand up to hate and promote unity at a time when our President employs multiple openly racist advisors like Sebastian Gorka, Steven Miller, Steven Bannon, and appointed Jeff Sessions as Attorney General. Both the Governor of Virginia and Mayor of Charlottesville were quick to denounce these gatherings, as were some other members of Congress, but Trump only tweeted 3 vague and generic sentences about unspecified \"hate.\" All elected officials in our government must join what should be a deafening chorus of denunciation against this kind of racist and hate-fueled speech.",
            "browser_url": null,
            "origin_system": "5Calls",
            "featured_image_url": null,
            "action_type": "phone",
            "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to express my outrage about the ugly demonstrations in Charlottesville. I demand that [REP/SEN NAME] join [his/her] colleagues on both sides of the aisle in denouncing the 'Unite the Right' white supremacist rally in Charlottesville. Protecting free speech does not equate to silence on matters of racism, hate, and violence.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
            "target_list": [],
            "identifiers": [
                "5Calls:reco1LA9EU4aQeoLu",
                "cta-aggregator:3c29ff31-d859-42fd-a786-c69306eadb86"
            ]
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/user",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/user"
                }
            },
            "targets": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/targets",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/targets"
                }
            },
            "target_list": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/target_list",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/target_list"
                }
            }
        }
    }
}

This endpoint retrieves a specific advocacy campaign.

HTTP Request

GET "https://www.resistr.tech/v1/advocacy_campaigns/<UUID>

URL Parameters

Parameter Description
ID The ID of the advocacy campaign to retrieve

Create an Advocacy Campaign

curl -X POST "https://www.resistr.tech/v1/advocacy_campaigns"
  -H "Content-Type: application/vnd.api+json"
  -H "Accept: application/vnd.api+json"
  -H "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1MDI2NjMwMjEsInN1YiI6ImI0ZDQ5MDAzLWEyMWYtNGVjZi1hYjM3LTQzMmRkMWM4MzE4MiJ9.Q_QeKrpgvelRZ-XB8gM1B1SSrjeGVEK93HLW2p4SoFJv5zICQV6aFiKyA1lJ8qhrPBzqIPtTgqQBTN9ng0c0PA"
  -d ' {
    "data": {
      "type": "advocacy_campaigns",
        "attributes": {
          "title": "Express Outrage at Open White Supremacy Rally in Charlottesville",
          "description": "Update (8/12): The 'Unite The Right' rally has turned violent after a car intentionally drove into a group of counter-protestors, leaving one dead and 19 others injured. We must stand up against this violence and hate.\n\nOn August 11th in Charlottesville, Virginia, a group of white protesters (mostly men) marched through the University of Virginia campus carrying torches and chanting “White Lives Matter” and “Jews Will Not Replace Us.\" As disturbing as this modern day KKK rally was, it was only a preview of the next day’s larger event in Emancipation Park: the \"Unite the Right” rally and march. No longer expecting consequences, these extremists did not bother to conceal their faces behind white hoods as in years past. Instead, they proudly raised their hands in Nazi salutes and used other anti-LGBT, anti-black, anti-Muslim chants and symbols. Attended by openly racist leaders like David Duke and Richard Spencer, there were multiple skirmishes between those carrying Nazi and Confederate flags and those counter protestings. Millions around the nation and world watch as American society is pummeled yet again by the destructive forces of hate.\n\nAlthough speech of all kinds is protected by the 1st Amendment, that protection does not require silence on the part of those who disagree. The American people need and deserve leadership that affirms the values of acceptance and inclusion that our country was founded upon and that we have struggled to extend to all people over the past 240+ years. The American people deserve leaders that stand up to hate and promote unity at a time when our President employs multiple openly racist advisors like Sebastian Gorka, Steven Miller, Steven Bannon, and appointed Jeff Sessions as Attorney General. Both the Governor of Virginia and Mayor of Charlottesville were quick to denounce these gatherings, as were some other members of Congress, but Trump only tweeted 3 vague and generic sentences about unspecified \"hate.\" All elected officials in our government must join what should be a deafening chorus of denunciation against this kind of racist and hate-fueled speech.",
          "browser_url": null,
          "origin_system": "5Calls",
          "featured_image_url": null,
          "action_type": "phone",
          "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to express my outrage about the ugly demonstrations in Charlottesville. I demand that [REP/SEN NAME] join [his/her] colleagues on both sides of the aisle in denouncing the 'Unite the Right' white supremacist rally in Charlottesville. Protecting free speech does not equate to silence on matters of racism, hate, and violence.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
          "target_list": [],
          "identifiers": [
            "5Calls:reco1LA9EU4aQeoLu",
          "cta-aggregator:3c29ff31-d859-42fd-a786-c69306eadb86"
          ]
        },
        "relationships": {
          "targets": {
            "data": [
            {
              "type": "targets",
              "id": "3c29ff31-d859-42fd-a786-c69306eadb86"
            }
          ]
        }
      }
    }
  } '
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

campaign_attrs = {
  title: 'Email Congressman - 1',
  description: 'Voluptas delectus distinctio maiores consequatur aspernatur.',
  browser_url: 'http://example.com/nya.lang',
  origin_system: '5Calls',
  featured_image_url: 'http://lorempixel.com/300/300',
  action_type: 'email',
  template: 'Eum itaque et nisi dolores assumenda ipsum. Voluptates qui aut nobis veniam maxime qui. Illum saepe eum corporis vero qui soluta aliquam.\nTemporibus reiciendis velit fugiat. Facere laborum quia ea laboriosam necessitatibus quisquam eligendi. Et est dolorem eligendi id aut sint.\nAnimi qui totam voluptatem nesciunt iure et dolorem. Eos ut dolorum et quo illum fuga atque. Facere a ipsa corrupti assumenda provident commodi facilis. Eligendi officia est et.',
  targets: ['a2f6f86b-a214-4892-8c06-8caece820fb0', '215ed993-3cd1-4fbc-b8af-7e2082813d06']
}
# Note: targets must exist prior to creating the Advocacy Campaign

response = CTAAggregatorClient::AdvocacyCampaign.create(campaign_attrs)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "3c29ff31-d859-42fd-a786-c69306eadb86",
        "type": "advocacy_campaigns",
        "links": {
            "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86"
        },
        "attributes": {
            "title": "Express Outrage at Open White Supremacy Rally in Charlottesville",
            "description": "Update (8/12): The 'Unite The Right' rally has turned violent after a car intentionally drove into a group of counter-protestors, leaving one dead and 19 others injured. We must stand up against this violence and hate.\n\nOn August 11th in Charlottesville, Virginia, a group of white protesters (mostly men) marched through the University of Virginia campus carrying torches and chanting “White Lives Matter” and “Jews Will Not Replace Us.\" As disturbing as this modern day KKK rally was, it was only a preview of the next day’s larger event in Emancipation Park: the \"Unite the Right” rally and march. No longer expecting consequences, these extremists did not bother to conceal their faces behind white hoods as in years past. Instead, they proudly raised their hands in Nazi salutes and used other anti-LGBT, anti-black, anti-Muslim chants and symbols. Attended by openly racist leaders like David Duke and Richard Spencer, there were multiple skirmishes between those carrying Nazi and Confederate flags and those counter protestings. Millions around the nation and world watch as American society is pummeled yet again by the destructive forces of hate.\n\nAlthough speech of all kinds is protected by the 1st Amendment, that protection does not require silence on the part of those who disagree. The American people need and deserve leadership that affirms the values of acceptance and inclusion that our country was founded upon and that we have struggled to extend to all people over the past 240+ years. The American people deserve leaders that stand up to hate and promote unity at a time when our President employs multiple openly racist advisors like Sebastian Gorka, Steven Miller, Steven Bannon, and appointed Jeff Sessions as Attorney General. Both the Governor of Virginia and Mayor of Charlottesville were quick to denounce these gatherings, as were some other members of Congress, but Trump only tweeted 3 vague and generic sentences about unspecified \"hate.\" All elected officials in our government must join what should be a deafening chorus of denunciation against this kind of racist and hate-fueled speech.",
            "browser_url": null,
            "origin_system": "5Calls",
            "featured_image_url": null,
            "action_type": "phone",
            "template": "Hi, my name is [NAME] and I’m a constituent from [CITY, ZIP].\n\nI'm calling to express my outrage about the ugly demonstrations in Charlottesville. I demand that [REP/SEN NAME] join [his/her] colleagues on both sides of the aisle in denouncing the 'Unite the Right' white supremacist rally in Charlottesville. Protecting free speech does not equate to silence on matters of racism, hate, and violence.\n\nThank you for your time and attention.\n\n[IF LEAVING A VOICEMAIL: please leave your full street address to ensure your call is tallied]",
            "target_list": [],
            "identifiers": [
                "5Calls:reco1LA9EU4aQeoLu",
                "cta-aggregator:3c29ff31-d859-42fd-a786-c69306eadb86"
            ]
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/user",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/user"
                }
            },
            "targets": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/targets",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/targets"
                }
            },
            "target_list": {
                "links": {
                    "self": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/relationships/target_list",
                    "related": "https://www.resistr.tech/v1/advocacy_campaigns/3c29ff31-d859-42fd-a786-c69306eadb86/target_list"
                }
            }
        }
    }
}

This endpoint creates a new advocacy campaign.

HTTP Request

POST "https://www.resistr.tech/v1/advocacy_campaigns/"

Requests to create a resource must include a valid JWT token. This token can be obtained from the authentication endpoint.

Targets

A Target resource is a sub-resource related to an Advocacy Campaign. Each Advocacy Campaign contains an array of targets. Each Target contains the following attributes.

Name Type Description
created_at datetime A read-only property representing the date and time the resource was created on the local system.
updated_at datetime A read-only property representing the date and time the resource was last modified on the local system.
title string The title or position of the target. (ex: “Senator” or “CEO”)
organization string The organization the target belongs to. (ex: “U.S. Senate” or “Acme Corporation”)
given_name string The first or given name of the target. (ex: “John”)
family_name string The last or family name of the target. (ex: “Smith”)
ocdid string array
identifiers array A unique string array of identifiers in the format [system name]:[id].
postal_addresses array Array of postal address info. See OSDI documentation
email_addresses array Email address, type, fields. See OSDI documentation
phone_numbers array Any phone numbers for target. See OSDI documentation

For more information on OSDI’s Target resource, follow this link: https://opensupporter.github.io/osdi-docs/advocacy_campaigns.html#target.

Get All Targets

curl -X GET "https://www.resistr.tech/v1/targets"
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

response = CTAAggregatorClient::Target.list
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": [
        {
            "id": "360cda45-6d93-42ae-a0fb-e1f6ebdba564",
            "type": "targets",
            "links": {
                "self": "https://www.resistr.tech/v1/targets/360cda45-6d93-42ae-a0fb-e1f6ebdba564"
            },
            "attributes": {
                "organization": "Senate Committee on Health",
                "given_name": null,
                "family_name": null,
                "ocdid": null,
                "postal_addresses": [],
                "email_addresses": [],
                "phone_numbers": [
                    {
                        "primary": true,
                        "number": "202-224-5375",
                        "number_type": "work"
                    }
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/targets/360cda45-6d93-42ae-a0fb-e1f6ebdba564/relationships/user",
                        "related": "https://www.resistr.tech/v1/targets/360cda45-6d93-42ae-a0fb-e1f6ebdba564/user"
                    }
                }
            }
        },
        {
            "id": "b92ff013-174d-4767-8892-645898cc5778",
            "type": "targets",
            "links": {
                "self": "https://www.resistr.tech/v1/targets/b92ff013-174d-4767-8892-645898cc5778"
            },
            "attributes": {
                "organization": "House Committee on Education and the Workforce",
                "given_name": null,
                "family_name": null,
                "ocdid": null,
                "postal_addresses": [],
                "email_addresses": [],
                "phone_numbers": [
                    {
                        "primary": true,
                        "number": "202-225-4527",
                        "number_type": "work"
                    }
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/targets/b92ff013-174d-4767-8892-645898cc5778/relationships/user",
                        "related": "https://www.resistr.tech/v1/targets/b92ff013-174d-4767-8892-645898cc5778/user"
                    }
                }
            }
        },
        {
            "id": "3718fcd2-4317-4ed2-8548-bba7af7d5d2a",
            "type": "targets",
            "links": {
                "self": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a"
            },
            "attributes": {
                "organization": " Department of Education",
                "given_name": "Betsy",
                "family_name": "DeVos",
                "ocdid": null,
                "postal_addresses": [],
                "email_addresses": [],
                "phone_numbers": [
                    {
                        "primary": true,
                        "number": "202-401-3000",
                        "number_type": "work"
                    }
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a/relationships/user",
                        "related": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a/user"
                    }
                }
            }
        },
        {
            "id": "e696019e-f2d5-4097-b046-1a9efe2d2965",
            "type": "targets",
            "links": {
                "self": "https://www.resistr.tech/v1/targets/e696019e-f2d5-4097-b046-1a9efe2d2965"
            },
            "attributes": {
                "organization": "House Judiciary Committee",
                "given_name": null,
                "family_name": null,
                "ocdid": null,
                "postal_addresses": [],
                "email_addresses": [],
                "phone_numbers": [
                    {
                        "primary": true,
                        "number": "202-225-3951",
                        "number_type": "work"
                    }
                ]
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "https://www.resistr.tech/v1/targets/e696019e-f2d5-4097-b046-1a9efe2d2965/relationships/user",
                        "related": "https://www.resistr.tech/v1/targets/e696019e-f2d5-4097-b046-1a9efe2d2965/user"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://www.resistr.tech/v1/targets?page%5Bnumber%5D=1&page%5Bsize%5D=10",
        "last": "https://www.resistr.tech/v1/targets?page%5Bnumber%5D=1&page%5Bsize%5D=10"
    }
}

This endpoint retrieves all targets.

HTTP Request

GET https://www.resistr.tech/v1/targets

Get a Specific Target

curl -X GET  "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a",
  -H "Accept: application/vnd.api+json"
  -H "Content-Type: application/vnd.api+json"
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

uuid = '3718fcd2-4317-4ed2-8548-bba7af7d5d2a'
response = CTAAggregatorClient::Target.find(uuid)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "3718fcd2-4317-4ed2-8548-bba7af7d5d2a",
        "type": "targets",
        "links": {
            "self": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a"
        },
        "attributes": {
            "organization": " Department of Education",
            "given_name": "Betsy",
            "family_name": "DeVos",
            "ocdid": null,
            "postal_addresses": [],
            "email_addresses": [],
            "phone_numbers": [
                {
                    "primary": true,
                    "number": "202-401-3000",
                    "number_type": "work"
                }
            ]
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a/relationships/user",
                    "related": "https://www.resistr.tech/v1/targets/3718fcd2-4317-4ed2-8548-bba7af7d5d2a/user"
                }
            }
        }
    }
}

This endpoint retrieves a specific target.

HTTP Request

GET "https://www.resistr.tech/v1/targets/<UUID>

URL Parameters

Parameter Description
ID The ID of the targets to retrieve

Create a Target


curl -X POST "https://www.resistr.tech/v1/targets"
  -H "Content-Type: application/vnd.api+json" 
  -H "Accept: application/vnd.api+json" 
  -H "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1MDI2NjMwMjEsInN1YiI6ImI0ZDQ5MDAzLWEyMWYtNGVjZi1hYjM3LTQzMmRkMWM4MzE4MiJ9.Q_QeKrpgvelRZ-XB8gM1B1SSrjeGVEK93HLW2p4SoFJv5zICQV6aFiKyA1lJ8qhrPBzqIPtTgqQBTN9ng0c0PA"
  -d ' {
    "data": {
        "type": "targets",
        "attributes": {
          "organization": " Department of Education",
          "given_name": "Betsy",
          "family_name": "DeVos",
          "ocdid": null,
          "postal_addresses": [ {
            "address_lines": "123 Fake Street",
            "locality": "Grand Rapids",
            "region": "MI",
            "postal_code": "49504"
          }],
          "email_addresses": [ {
            "primary": "true",
            "address": "insano@example.com",
            "address_type": "work"
          } ],
          "phone_numbers": [
          {
            "primary": true,
            "number": "202-401-3000",   
            "number_type": "work"
          }
          ]
        }
    }
  } '
require 'cta_aggregator_client'
# Configure gem (for directions, see gem's README)

target_attributes = {
  organization: 'Mohr Inc',
  given_name: 'Pascale',
  family_name: 'White',
  ocdid: 'b4503418-6aab-451a-8e55-11ffd575bc85',
  postal_addresses: [
    {
      primary: true,
      address_type: 'Office',
      venue: 'Southern Nitzsche',
      address_lines: [
       '36261 Kovacek Prairie',
        'Apt. 760'
      ],
      locality: 'West Brandynfort',
      region: 'WV',
      postal_code: '66900-1309',
      country: 'US'
    }
  ],
  email_addresses: [
    {
      primary: true,
      address: 'jeffry_durgan@rutherfordcarroll.net',
      address_type: 'work'
     }
  ],
  phone_numbers: [
    {
      primary: true,
      number: '(606) 087-8543 x254',
      extension: '4594',
      number_type: 'work'
    }
 ]
}

response = CTAAggregatorClient::Target.create(target_attrs)
JSON.parse(response.body)

The above command returns JSON structured like this:

{
    "data": {
        "id": "9927bf38-dcaa-448c-acc7-4a4920466188",
        "type": "targets",
        "links": {
            "self": "https://www.resistr.tech/v1/targets/9927bf38-dcaa-448c-acc7-4a4920466188"
        },
        "attributes": {
            "organization": " Department of Education",
            "given_name": "Betsy",
            "family_name": "DeVos",
            "ocdid": null,
            "postal_addresses": [
                {
                    "locality": "Grand Rapids",
                    "region": "MI",
                    "postal_code": "49504"
                }
            ],
            "email_addresses": [
                {
                    "primary": "true",
                    "address": "insano@example.com",
                    "address_type": "work"
                }
            ],
            "phone_numbers": [
                {
                    "primary": true,
                    "number": "202-401-3000",
                    "number_type": "work"
                }
            ]
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://www.resistr.tech/v1/targets/9927bf38-dcaa-448c-acc7-4a4920466188/relationships/user",
                    "related": "https://www.resistr.tech/v1/targets/9927bf38-dcaa-448c-acc7-4a4920466188/user"
                }
            }
        }
    }
}

This endpoint creates a new target.

HTTP Request

POST "https://www.resistr.tech/v1/targets/"

Requests to create a resource must include a valid JWT token. This token can be obtained from the authentication endpoint.

Errors

The CTA Aggregator API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your API key is wrong
403 Forbidden – The resource requested is reserved for administrators only
404 Not Found – The specified resource could not be found
405 Method Not Allowed – You tried to access a resource with an invalid method
406 Not Acceptable – You requested a format that isn’t json
410 Gone – The resource requested has been removed from our servers
418 I’m a teapot
429 Too Many Requests
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarily offline for maintenance. Please try again later.

Embedding CTA

The Call to Action feed can be embedded in your web site using AJAX calls. The API automatically sets Cross-origin resource sharing (CORS) headers allowing AJAX calls from browsers visiting your domain to the API’s domain. Note, this feature depends on the HTTP Origin header being sent. Web browsers do this automatically, however when debugging with tools like curl or Postman, you may need to explicitly set it, e.g. curl -H 'Origin: example.com'.

Calling the API with pure JavaScript

To call the API in JavaScript you use XMLHttpRequest(). The onload function will be called with the API data.

Basic JavaScript Call

req=new XMLHttpRequest();
req.onload=function(){
    response = JSON.parse(req.responseText);
    console.log(response);
};
req.open("GET",'https://www.resistr.tech/v1/events',true);
req.send();

The actual events will be an array returned in response.data, response.data[0].title would contain the first event’s title. Typically, you would loop over this data add it to your page.

Loop Through Events

response.data.forEach(function(event) {
    document.body.innerHTML += '<p>' + event.title + '</p>';
});

This example use the above JavaScript to fetch events and adds them to the page in a simple definition list.

It’s a bit easier to use the API with libraries like jQuery:

jQuery Version

$.get( "https://www.resistr.tech/v1/events", function( response ) {
   console.log(response);
});

This example fetches the events with jQuery and styles them using the Bootstrap framework.