Action Network
Overview
Action Network is an online tool for storing information and organizing volunteers and donors. It is used primarily for digital organizing and event mangement. For more information, see Action Network developer docs, SQL Mirror developer docs
Note
- Authentication
Only ActionNetwork accounts of the partner tier are able to access their API. You can generate your key from the API & Sync page, located in the Start Organizing menu, under Details.
Quick Start
To instantiate a class, you can either pass in the API token as an argument or set the AN_API_TOKEN
environmental variable.
from parsons import ActionNetwork
# First approach: Use API credentials via environmental variables
an = ActionNetwork()
# Second approach: Pass API credentials as arguments
an = ActionNetwork(api_token='MY_API_TOKEN')
You can then call various endpoints:
# List all people stored in Action Network
all_contacts = an.get_people()
# Add a person
an.add_person('person.email@fakeemail.com')
# Add a tag
an.add_tag('fake_tag')
# Update a person
an.update_person('fake_id', given_name='new_given_name', tags=['tag_1', 'tag_2'])
# Get all taggings associated with a specific tag
all_taggings = an.get_taggings('tag_id')
# Get a specific tagging
specific_tagging = an.get_tagging('tag_id', 'tagging_id')
# Create a tagging
tagging_payload = {
"_links" : {
"osdi:person" : { "href" : "https://actionnetwork.org/api/v2/people/123" }
}
}
created_tagging = an.create_tagging('tag_id', tagging_payload)
# Result
created_tagging = {
"_links": {
"self": {
"href": "https://actionnetwork.org/api/v2/tags/123/taggings/123"
},
"osdi:tag": {
"href": "https://actionnetwork.org/api/v2/tags/123"
},
"osdi:person": {
"href": "https://actionnetwork.org/api/v2/people/123"
},
"curies": [
{
"name": "osdi",
"href": "https://actionnetwork.org/docs/v2/{rel}",
"templated": true
},
{
"name": "action_network",
"href": "https://actionnetwork.org/docs/v2/{rel}",
"templated": true
}
]
},
"identifiers": [
"action_network:123"
],
"created_date": "2014-03-18T22:25:31Z",
"modified_date": "2014-03-18T22:25:38Z",
"item_type": "osdi:person"
}
# Delete a tagging
an.delete_tagging('tag_id', 'tagging_id')
# Get all wrappers
all_wrappers = an.get_wrappers()
# Get a specific wrapper
specific_wrapper = an.get_wrapper('wrapper_id')
SQL Mirror
from parsons.utilities.ssh_utilities import query_through_ssh
# Define SSH and database parameters
ssh_host = 'ssh.example.com'
ssh_port = 22
ssh_username = 'user'
ssh_password = 'pass'
db_host = 'db.example.com'
db_port = 5432
db_name = 'testdb'
db_username = 'dbuser'
db_password = 'dbpass'
query = 'SELECT * FROM table'
# Use the function to query through SSH
result = query_through_ssh(
ssh_host, ssh_port, ssh_username, ssh_password,
db_host, db_port, db_name, db_username, db_password, query
)
# Output the result
print(result)
API
- class parsons.ActionNetwork(api_token=None)[source]
- Args:
- api_token: str
The OSDI API token
- get_advocacy_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all of the advocacy_campaigns (letters) entries
- Documentation Reference:
- get_advocacy_campaign(advocacy_campaign_id)[source]
- Args:
- advocacy_campaign_id:
The unique id of the advocacy_campaign
- Returns:
A JSON with advocacy_campaign entry
- Documentation Reference:
- get_person_attendances(person_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- person_id:
The unique id of the person
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the attendances entries
- Documentation Reference:
- get_event_attendances(event_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
event_id: the unique id of the event limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with the attendances entries related to the event
- Documentation Reference:
- get_event_attendance(event_id, attendance_id)[source]
- Args:
- event_id:
The unique id of the event
- attendance_id:
The unique id of the attendance
- Returns:
A JSON with the attendance entry
- Documentation Reference:
- get_person_attendance(person_id, attendance_id)[source]
- Args:
- person_id:
The unique id of the person
- attendance_id:
The unique id of the attendance
- Returns:
A JSON with the attendance entry
- Documentation Reference:
- create_attendance(event_id, payload)[source]
- Args:
event_id: the unique id of the event payload: the payload for creating the event attendance
- {
- “_links”{
“osdi:person” : { “href” : “https://actionnetwork.org/api/v2/people/id” }
}
}
- Returns:
A JSON response after creating the event attendance
- Documentation Reference:
- update_attendance(event_id, attendance_id, payload)[source]
- Args:
- event_id:
The unique id of the event
- attendance_id:
The unique id of the attendance
- payload:
The payload for updating the event attendance {
- “identifiers”: [
“other-system:230125a”
]
}
- Returns:
A JSON response after updating the event attendance
- Documentation Reference:
- get_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all of the campaigns entries
- Documentation Reference:
- get_campaign(campaign_id)[source]
- Args:
- campaign_id:
The unique id of the campaign
- Returns:
A JSON with the campaign entry
- Documentation Reference:
- get_custom_fields()[source]
- Args:
None
- Returns:
A JSON with the custom_fields associated with your API key.
- Documentation Reference:
- get_donation(donation_id)[source]
- Args:
donation_id: The unique id of the donation
- Returns:
A JSON with donation data
- Documentation Reference:
- get_donations(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the donations entries
- Documentation Reference:
- get_fundraising_page_donations(fundraising_page_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
fundraising_page_id: The id of the fundraiser limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with fundraising_page entry
- Documentation Reference:
- get_person_donations(person_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
person_id: The id of the person limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all donations related to person
- Documentation Reference:
- create_donation(fundraising_page_id, donation_payload)[source]
- Args:
fundraising_page_id: The id of the fundraising page donation_payload: The payload containing donation details
- {
- “recipients”: [
- {
“display_name”: “Campaign To Elect Tom”, “amount”: “3.00”
}
], “created_date”: “2013-01-01T00:00:00Z”, “_links” : {
“osdi:person” : { “href” : “link” }
}
}
- Returns:
A JSON response confirming the creation of the donation
- Documentation Reference:
- get_embeds(action_type, action_id)[source]
- Args:
- action_type:
The action type (petition, events, etc.)
- action_id:
The unique id of the action
- Returns:
A JSON with the embeds (for you to be able to embed action outside of ActionNetwork).
- Documentation Reference:
- get_event_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the event_campaigns entries
- Documentation Reference:
- get_event_campaign(event_campaign_id)[source]
- Args:
- event_campaign_id:
The unique id of the event_campaign
- Returns:
A JSON with event_campaign entry
- Documentation Reference:
- create_event_campaign(payload)[source]
- Args:
- payload: The payload containing event campaign details
- {
“title”: “My Canvassing Event”, “origin_system”: “CanvassingEvents.com”
}
- Returns:
A JSON response confirming the creation of the event campaign
- Documentation Reference:
- create_event_in_event_campaign(event_campaign_id, payload)[source]
- Args:
- event_campaign_id:
The unique id of the event_campaign
- payload:
The payload containing event details {
“title”: “My Free Event”, “origin_system”: “FreeEvents.com”
}
- Returns:
A JSON response confirming the creation of the event in the event campaign
- Documentation Reference:
- update_event_campaign(event_campaign_id, payload)[source]
- Args:
- event_campaign_id:
The unique id of the event_campaign
- payload:
The payload containing event campaign details {
“description”: “This is my new event campaign description”
}
- Returns:
A JSON response confirming the update of the event campaign
- Documentation Reference:
- get_events(limit=None, per_page=25, page=None, filter=None)[source]
Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the events entries
- Documentation Reference:
- get_event(event_id)[source]
- Args:
event_id: the unique id of the event
- Returns:
A JSON with event entry
- Documentation Reference:
- get_event_campaign_events(event_campaign_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- event_campaign_id:
The unique id of the event_campaign
- limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the eventes related to the event_campaign entry
- Documentation Reference:
- create_event(title, start_date=None, location=None)[source]
Create an event in Action Network
- Args:
- title: str
The public title of the event
- start_date: str OR datetime
OPTIONAL: The starting date & time. If a string, use format “YYYY-MM-DD HH:MM:SS” (hint: the default format you get when you use str() on a datetime)
- location: dict
OPTIONAL: A dict of location details. Can include any combination of the types of values in the following example: .. code-block:: python
- my_location = {
“venue”: “White House”, “address_lines”: [
“1600 Pennsylvania Ave”
], “locality”: “Washington”, “region”: “DC”, “postal_code”: “20009”, “country”: “US”
}
- Returns:
Dict of Action Network Event data.
- Documentation Reference:
- update_event(event_id, payload)[source]
Update an event in Action Network
- Args:
- event_id: str
The unique id of the event
- payload: dict
The payload containing event data (see https://actionnetwork.org/docs/v2/events) {
“title”: “My Free Event With A New Name”, “description”: “This is my free event description”
}
- Returns:
A JSON response confirming the update of the event
- Documentation Reference:
- get_forms(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the forms entries
- Documentation Reference:
- get_form(form_id)[source]
- Args:
- form_id:
The unique id of the form
- Returns:
A JSON with form entry
- Documentation Reference:
- create_form(payload)[source]
Create a form in Action Network
- Args:
- payload: dict
The payload containing form details
- {
“title”: “My Free Form”, “origin_system”: “FreeForms.com”
}
- Returns:
A JSON response confirming the creation of the form
- Documentation Reference:
- update_form(form_id, payload)[source]
Update a form in Action Network
- Args:
- form_id:
The unique id of the form
- payload: dict
The payload containing form data (see https://actionnetwork.org/docs/v2/forms)
- {
“title”: “My Free Form”, “origin_system”: “FreeForms.com”
}
- Returns:
A JSON response confirming the update of the form
- Documentation Reference:
- get_fundraising_page(fundraising_page_id)[source]
- Args:
fundraising_page_id: The id of the fundraiser
- Returns:
A JSON with fundraising_page entry
- Documentation Reference:
- get_fundraising_pages(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the fundraising_pages entries
- Documentation Reference:
- create_fundraising_page(payload)[source]
Create a fundraising page in Action Network
- Args:
- payload: dict
The payload containing fundraising page details {
“title”: “My Free Fundraiser”, “origin_system”: “FreeFundraisers.com”
}
- Returns:
A JSON response confirming the creation of the fundraising page
- Documentation Reference:
- update_fundraising_page(fundraising_page_id, payload)[source]
Update a fundraising page in Action Network
- Args:
fundraising_page_id: The id of the fundraiser payload: dict
The payload containing updated fundraising page details {
“title”: “My Free Fundraiser”, “origin_system”: “FreeFundraisers.com”
}
- Returns:
A JSON response confirming the update of the fundraising page
- Documentation Reference:
- get_items(list_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- list_id:
The unique id of the list
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the list item entries
- Documentation Reference:
- get_item(list_id, item_id)[source]
- Args:
- list_id:
The unique id of the list
- item_id:
The unique id of the item
- Returns:
A JSON with the item entry
- Documentation Reference:
- get_lists(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the list entries
- Documentation Reference:
- get_list(list_id)[source]
- Args:
- list_id:
The unique id of the list
- Returns:
A JSON with the list entry
- Documentation Reference:
- get_messages(limit=None, per_page=25, page=None, filter=None, unpack_statistics=False)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- unpack_statistics:
Whether to unpack the statistics dictionary into the table. Default to False.
- Returns:
A Parsons Table with all the messages related entries
- Documentation Reference:
- get_message(message_id)[source]
- Args:
- message_id:
The unique id of the message
- Returns:
A JSON with the signature entry.
- Documentation Reference:
- create_message(payload)[source]
Create a message in Action Network
- Args:
- payload: dict
The payload containing message details {
“subject”: “Stop doing the bad thing”, “body”: “<p>The mayor should stop doing the bad thing.</p>”, “from”: “Progressive Action Now”, “reply_to”: “jane@progressiveactionnow.org”, “targets”: [
- {
}
], “_links”: {
- “osdi:wrapper”: {
}
}
}
- Returns:
A JSON response confirming the creation of the message
- Documentation Reference:
- update_message(message_id, payload)[source]
Update a message in Action Network
- Args:
- message_id:
The unique id of the message
- payload: dict
The payload containing message details to be updated {
“name”: “Stop doing the bad thing email send 1”, “subject”: “Please! Stop doing the bad thing”
}
- Returns:
A JSON response confirming the update of the message
- Documentation Reference:
- get_advocacy_campaign_outreaches(advocacy_campaign_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- advocacy_campaign_id:
The unique id of the advocacy_campaign
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the outreaches entries related to the advocacy_campaign_id
- Documentation Reference:
- get_person_outreaches(person_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- person_id:
The unique id of the person
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the outreaches entries related to our group
- Documentation Reference:
- get_advocacy_campaign_outreach(advocacy_campaign_id, outreach_id)[source]
- Args:
- advocacy_campaign_id:
The unique id of the campaign
- outreach_id:
The unique id of the outreach
- Returns:
A JSON with the outreach entry
- Documentation Reference:
- get_person_outreach(person_id, outreach_id)[source]
- Args:
- person_id:
The unique id of the campaign
- outreach_id:
The unique id of the outreach
- Returns:
A JSON with the outreach entry
- Documentation Reference:
- create_outreach(advocacy_campaign_id, payload)[source]
Create an outreach in Action Network
- Args:
- advocacy_campaign_id:
The unique id of the campaign
- payload:
The payload containing outreach details {
- “targets”: [
- {
“given_name”: “Joe”, “family_name”: “Schmoe”
}
], “_links” : {
“osdi:person” : { “href” : “https://actionnetwork.org/api/v2/people/id” }
}
}
- Returns:
A JSON response confirming the creation of the outreach
- Documentation Reference:
- update_outreach(advocacy_campaign_id, outreach_id, payload)[source]
Update an outreach in Action Network
- Args:
- advocacy_campaign_id:
The unique id of the campaign
- outreach_id:
The unique id of the outreach
- payload:
The payload containing outreach details to be updated {
“subject”: “Please vote no!”
}
- Returns:
A JSON response confirming the update of the outreach
- Documentation Reference:
- get_people(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page
The number of entries per page to return. 25 maximum.
- page
Which page of results to return
- filter
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A list of JSONs of people stored in Action Network.
- Documentation Reference:
- get_person(person_id)[source]
- Args:
- person_id:
Id of the person.
- Returns:
A JSON of the entry. If the entry doesn’t exist, Action Network returns
{'error': 'Couldn't find person with id = <id>'}
.- Documentation Reference:
- upsert_person(email_address: str | List[str] | List[Dict[str, str]] = None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number=None, mobile_status: Literal['subscribed', 'unsubscribed', None] = None, background_processing=False, **kwargs)[source]
Creates or updates a person record. In order to update an existing record instead of creating a new one, you must supply an email or mobile number which matches a record in the database.
Identifiers are intentionally not included as an option on this method, because their use can cause buggy behavior if they are not globally unique. ActionNetwork support strongly encourages developers not to use custom identifiers.
- Args:
- email_address:
- Either email_address or mobile_number are required. Can be any of the following
a string with the person’s email
a list of strings with a person’s emails
- a list of dictionaries with the following fields
address (REQUIRED)
primary (OPTIONAL): Boolean indicating the user’s primary email address
- status (OPTIONAL): can taken on any of these values
“subscribed”
“unsubscribed”
“bouncing”
“previous bounce”
“spam complaint”
“previous spam complaint”
- given_name:
The person’s given name
- family_name:
The person’s family name
- tags:
Optional field. A list of strings of pre-existing tags to be applied to the person.
- languages_spoken:
Optional field. A list of strings of the languages spoken by the person
- postal_addresses:
Optional field. A list of dictionaries. For details, see Action Network’s documentation: https://actionnetwork.org/docs/v2/person_signup_helper
- mobile_number:
- Either email_address or mobile_number are required. Can be any of the following
a string with the person’s cell phone number
an integer with the person’s cell phone number
a list of strings with the person’s cell phone numbers
a list of integers with the person’s cell phone numbers
- a dictionary with the following fields
number (REQUIRED)
primary (OPTIONAL): Boolean indicating the user’s primary mobile number
- status (OPTIONAL): can taken on any of these values
“subscribed”
“unsubscribed”
- mobile_status:
None, ‘subscribed’ or ‘unsubscribed’. If included, will update the SMS opt-in status of the phone in ActionNetwork. If not included, won’t update the status. None by default, causes no updates to mobile number status. New numbers are set to “unsubscribed” by default.
- background_request: bool
If set true, utilize ActionNetwork’s “background processing”. This will return an immediate success, with an empty JSON body, and send your request to the background queue for eventual processing. https://actionnetwork.org/docs/v2/#background-processing
- **kwargs:
Any additional fields to store about the person. Action Network allows any custom field.
Adds a person to Action Network Documentation Reference:
- add_person(email_address=None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number=None, mobile_status='subscribed', **kwargs)[source]
Creates a person in the database. WARNING: this endpoint has been deprecated in favor of upsert_person.
- update_person(entry_id, background_processing=False, **kwargs)[source]
Updates a person’s data in Action Network, given their Action Network ID. Note that you can’t alter a person’s tags with this method. Instead, use upsert_person.
- Args:
- entry_id:
The person’s Action Network id
- background_processing: bool
If set true, utilize ActionNetwork’s “background processing”. This will return an immediate success, with an empty JSON body, and send your request to the background queue for eventual processing. https://actionnetwork.org/docs/v2/#background-processing
- **kwargs:
- Fields to be updated. The possible fields are
- email_address:
- Can be any of the following
a string with the person’s email
- a dictionary with the following fields
- email_address (REQUIRED)
primary (OPTIONAL): Boolean indicating the user’s
primary email address
- status (OPTIONAL): can taken on any of these values
“subscribed”
“unsubscribed”
“bouncing”
“previous bounce”
“spam complaint”
“previous spam complaint”
- given_name:
The person’s given name
- family_name:
The person’s family name
- languages_spoken:
Optional field. A list of strings of the languages spoken by the person
- postal_addresses:
Optional field. A list of dictionaries. For details, see Action Network’s documentation: https://actionnetwork.org/docs/v2/people#put
- custom_fields:
A dictionary of any other fields to store about the person.
- Documentation Reference:
- get_petitions(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all of the petitions entries
- Documentation Reference:
- get_petition(petition_id)[source]
- Args:
- petition_id:
The unique id of the petition
- Returns:
A JSON with the petition entry
- Documentation Reference:
- create_petition(title, description, petition_text, target, background_processing=False)[source]
- Args:
- title:
The title of the petition
- description:
The description of the petition
- petition_text:
The text of the petition
- target:
The target of the petition
- background_processing:
Whether to process the request in the background
- Returns:
A JSON with the response from the API
- Documentation Reference:
- update_petition(petition_id, title, description, petition_text, target, background_processing=False)[source]
- Args:
- petition_id:
The unique id of the petition to be updated
- title:
The updated title of the petition
- description:
The updated description of the petition
- petition_text:
The updated text of the petition
- target:
The updated target of the petition
- background_processing:
Whether to process the request in the background
- Returns:
A JSON with the response from the API
- Documentation Reference:
- get_queries(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the query entries
- Documentation Reference:
- get_query(query_id)[source]
- Args:
- query_id:
The unique id of the query
- Returns:
A JSON with the query entry
- Documentation Reference:
- get_petition_signatures(petition_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- petition_id:
The unique id of the petition
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the signatures related to the petition entry
- Documentation Reference:
- get_person_signatures(person_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- person_id:
The unique id of the person
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the signatures related to the petition entry
- Documentation Reference:
- get_petition_signature(petition_id, signature_id)[source]
- Args:
- petition_id:
The unique id of the petition
- signature_id:
The unique id of the signature
- Returns:
A JSON with the signature entry
- Documentation Reference:
- get_person_signature(person_id, signature_id)[source]
- Args:
- person_id:
The unique id of the person
- signature_id:
The unique id of the signature
- Returns:
A JSON with the signature entry
- Documentation Reference:
- create_signature(petition_id, data)[source]
- Args:
- petition_id:
The unique id of the petition
- data:
The payload for creating the signature {
“comments” : “Stop doing the thing”, “_links” : {
“osdi:person” : { “href” : “https://actionnetwork.org/api/v2/people/id” }
}
}
- Returns:
A JSON with the created signature entry
- Documentation Reference:
- update_signature(petition_id, signature_id, data)[source]
- Args:
- petition_id:
The unique id of the petition
- signature_id:
The unique id of the signature
- data:
The signature payload to update {
“comments”: “Some new comments”
}
- Returns:
A JSON with the updated signature entry
- Documentation Reference:
- get_form_submissions(form_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- form_id:
The unique id of the form
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the submissions entries related to the form
- Documentation Reference:
- get_person_submissions(person_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- person_id:
The unique id of the person
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the submissions entries related with our group
- Documentation Reference:
- get_form_submission(form_id, submission_id)[source]
- Args:
- form_id:
The unique id of the form
- submission_id:
The unique id of the submission
- Returns:
A JSON with the submission entry
- Documentation Reference:
- get_person_submission(person_id, submission_id)[source]
- Args:
- person_id:
The unique id of the submission
- submission_id:
The unique id of the submission
- Returns:
A JSON with the submission entry
- Documentation Reference:
- create_submission(form_id, person_id)[source]
- Args:
- form_id:
The unique id of the form
- person_id:
The unique id of the person
- Returns:
A JSON response indicating the success or failure of the submission creation
- Documentation Reference:
- update_submission(form_id, submission_id, data)[source]
- Args:
- form_id:
The unique id of the form
- submission_id:
The unique id of the submission
- data:
The payload for updating the submission {
- “_links”{
“osdi:person” : { “href” : “https://actionnetwork.org/api/v2/people/id” }
}
}
- Returns:
A JSON with the updated submission entry
- Documentation Reference:
- get_tags(limit=None, per_page=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
This is a deprecated argument.
- Returns:
A list of JSONs of tags in Action Network.
- Documentation Reference:
- get_tag(tag_id)[source]
- Args:
- tag_id:
Id of the tag.
- Returns:
A JSON of the entry. If the entry doesn’t exist, Action Network returns “{‘error’: ‘Couldn’t find tag with id = <id>’}”
- Documentation Reference:
- add_tag(name)[source]
- Args:
- name:
The tag’s name. This is the ONLY editable field
Adds a tag to Action Network. Once created, tags CANNOT be edited or deleted. Documentation Reference:
- get_taggings(tag_id, limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- tag_id:
The unique id of the tag
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the tagging entries associated with the tag_id
- Documentation Reference:
- get_tagging(tag_id, tagging_id)[source]
- Args:
- tag_id:
The unique id of the tag
- tagging_id:
The unique id of the tagging
- Returns:
A JSON with the tagging entry
- Documentation Reference:
- create_tagging(tag_id, payload)[source]
- Args:
- tag_id:
The unique id of the tag
- payload:
The payload for creating the tagging {
- “_links”{
“osdi:person” : { “href” : “https://actionnetwork.org/api/v2/people/id” }
}
}
- Returns:
A JSON response after creating the tagging
- Documentation Reference:
- delete_tagging(tag_id, tagging_id)[source]
- Args:
- tag_id:
The unique id of the tag
- tagging_id:
The unique id of the tagging to be deleted
- Returns:
A JSON response after deleting the tagging
- Documentation Reference:
- get_wrappers(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
- limit:
The number of entries to return. When None, returns all entries.
- per_page:
The number of entries per page to return. 25 maximum.
- page:
Which page of results to return
- filter:
The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.
- Returns:
A JSON with all the wrapper entries
- Documentation Reference:
- get_wrapper(wrapper_id)[source]
- Args:
- wrapper_id:
The unique id of the wrapper
- tagging_id:
The unique id of the tagging
- Returns:
A JSON with the wrapper entry
- Documentation Reference:
- get_unique_id_lists(limit=None, per_page=25, page=None, filter=None)[source]
- Args:
limit: The maximum number of unique ID lists to return. When None, returns all unique ID lists. per_page: The number of unique ID lists to return per page. Default is 25. page: The specific page of unique ID lists to return. filter: The filter criteria to apply when retrieving unique ID lists.
- Returns:
A JSON response with the unique ID lists.
- Documentation Reference: