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]¶
- Parameters:
api_token – str OSDI API token
- get_advocacy_campaigns(limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
advocacy_campaign_id – 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]¶
- Parameters:
person_id – Unique ID of the person
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
event_id – Unique ID of the event
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
event_id – Unique ID of the event
attendance_id – Unique ID of the attendance
- Returns:
A JSON with the attendance entry
- Documentation Reference:
- get_person_attendance(person_id, attendance_id)[source]¶
- Parameters:
person_id – Unique ID of the person
attendance_id – Unique ID of the attendance
- Returns:
A JSON with the attendance entry
- Documentation Reference:
- create_attendance(event_id, payload)[source]¶
- Parameters:
event_id – Unique ID of the event
payload –
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]¶
- Parameters:
event_id – Unique ID of the event
attendance_id – Unique ID of the attendance
payload –
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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Page of results to return
filter – 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]¶
- Parameters:
campaign_id – Unique ID of the campaign
- Returns:
A JSON with the campaign entry
- Documentation Reference:
- get_custom_fields()[source]¶
- Parameters:
None
- Returns:
A JSON with the custom_fields associated with your API key.
- Documentation Reference:
- get_donation(donation_id)[source]¶
- Parameters:
donation_id – 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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
fundraising_page_id – The ID of the fundraiser
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
person_id – The ID of the person
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
fundraising_page_id – The ID of the fundraising page
donation_payload –
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]¶
- Parameters:
action_type – Action type (petition, events, etc.)
action_id – 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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
event_campaign_id – Unique ID of the event_campaign
- Returns:
A JSON with event_campaign entry
- Documentation Reference:
- create_event_campaign(payload)[source]¶
- Parameters:
payload –
Payload containing event campaign details
- Returns:
A JSON response confirming the creation of the event campaign
- Documentation Reference:
- create_event_in_event_campaign(event_campaign_id, payload)[source]¶
- Parameters:
event_campaign_id – Unique ID of the event_campaign
payload –
Payload containing event details
- Returns:
A JSON response confirming the creation of the event in the event campaign
- Documentation Reference:
- update_event_campaign(event_campaign_id, payload)[source]¶
- Parameters:
event_campaign_id – Unique ID of the event_campaign
payload –
Payload containing event campaign details
- Returns:
A JSON response confirming Update of the event campaign
- Documentation Reference:
- get_events(limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
event_id – 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]¶
- Parameters:
event_campaign_id – Unique ID of the event_campaign
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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
- Parameters:
title – str 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:
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
- Parameters:
event_id – str Unique ID of the event
payload –
dict Payload containing event data (see https://actionnetwork.org/docs/v2/events)
- Returns:
A JSON response confirming Update of the event
- Documentation Reference:
- get_forms(limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
form_id – Unique ID of the form
- Returns:
A JSON with form entry
- Documentation Reference:
- create_form(payload)[source]¶
Create a form in Action Network
- Parameters:
payload –
dict Payload containing form details
- Returns:
A JSON response confirming the creation of the form
- Documentation Reference:
- update_form(form_id, payload)[source]¶
Update a form in Action Network
- Parameters:
form_id – Unique ID of the form
payload –
dict Payload containing form data (see https://actionnetwork.org/docs/v2/forms)
- Returns:
A JSON response confirming Update of the form
- Documentation Reference:
- get_fundraising_page(fundraising_page_id)[source]¶
- Parameters:
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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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
- Parameters:
payload –
dict Payload containing fundraising page details
- 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
- Parameters:
fundraising_page_id – The ID of the fundraiser
payload –
dict Payload containing updated fundraising page details
- Returns:
A JSON response confirming Update of the fundraising page
- Documentation Reference:
- get_items(list_id, limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
list_id – Unique ID of the list
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
list_id – Unique ID of the list
item_id – 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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
list_id – 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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
message_id – Unique ID of the message
- Returns:
A JSON with the signature entry.
- Documentation Reference:
- create_message(payload)[source]¶
Create a message in Action Network
- Parameters:
payload –
dict Payload containing message details
- Returns:
A JSON response confirming the creation of the message
- Documentation Reference:
- update_message(message_id, payload)[source]¶
Update a message in Action Network
- Parameters:
message_id – Unique ID of the message
payload –
dict Payload containing message details to be updated
- Returns:
A JSON response confirming Update of the message
- Documentation Reference:
- schedule_message(message_id, scheduled_start_date)[source]¶
Schedule a message in Action Network
- Parameters:
message_id – Unique ID of the message
scheduled_start_date – UTC timestamp to schedule the message at in ISO8601 format. e.g. “2015-03-14T12:00:00Z”
- Returns:
A JSON response confirming the scheduling
- Documentation Reference:
- send_message(message_id)[source]¶
Send a message in Action Network
- Parameters:
message_id – Unique ID of the message
- Returns:
A JSON response confirming the message was sent
- Documentation Reference:
- get_metadata()[source]¶
- Parameters:
None
- Returns:
A JSON with the metadata entry
- Documentation Reference:
- get_advocacy_campaign_outreaches(advocacy_campaign_id, limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
advocacy_campaign_id – Unique ID of the advocacy_campaign
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
person_id – Unique ID of the person
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
advocacy_campaign_id – Unique ID of the campaign
outreach_id – Unique ID of the outreach
- Returns:
A JSON with the outreach entry
- Documentation Reference:
- get_person_outreach(person_id, outreach_id)[source]¶
- Parameters:
person_id – Unique ID of the campaign
outreach_id – 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
- Parameters:
advocacy_campaign_id – Unique ID of the campaign
payload –
Payload containing outreach details
- 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
- Parameters:
advocacy_campaign_id – Unique ID of the campaign
outreach_id – Unique ID of the outreach
payload –
Payload containing outreach details to be updated
- Returns:
A JSON response confirming Update of the outreach
- Documentation Reference:
- get_people(limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
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[Literal['address', 'primary', 'status'], str | bool]] | None = None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number: str | int | list[str | int] | list[dict[Literal['address', 'primary', 'status'], str | bool]] | None = 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.
- Parameters:
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 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 – Person’s given name
family_name – 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 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_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 – Any additional fields to store about the person. Action Network allows any custom field.
- Documentation Reference:
- add_person(email_address: str | list[str] | list[dict[Literal['address', 'primary', 'status'], str | bool]] | None = None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number: str | int | list[str | int] | list[dict[Literal['address', 'primary', 'status'], str | bool]] | None = None, mobile_status: Literal['subscribed', 'unsubscribed'] | None = '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.
- Parameters:
entry_id – 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 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:
Person’s given name
- family_name:
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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
petition_id – 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]¶
- Parameters:
title – Title of the petition
description – Description of the petition
petition_text – Text of the petition
target – 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]¶
- Parameters:
petition_id – Unique ID of the petition to be updated
title – Updated title of the petition
description – Updated description of the petition
petition_text – Updated text of the petition
target – 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]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
query_id – 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]¶
- Parameters:
petition_id – Unique ID of the petition
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
person_id – Unique ID of the person
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
petition_id – Unique ID of the petition
signature_id – Unique ID of the signature
- Returns:
A JSON with the signature entry
- Documentation Reference:
- get_person_signature(person_id, signature_id)[source]¶
- Parameters:
person_id – Unique ID of the person
signature_id – Unique ID of the signature
- Returns:
A JSON with the signature entry
- Documentation Reference:
- create_signature(petition_id, data)[source]¶
- Parameters:
petition_id – Unique ID of the petition
data –
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]¶
- Parameters:
petition_id – Unique ID of the petition
signature_id – Unique ID of the signature
data –
Signature payload to update
{ "comments": "Some new comments" }
- Returns:
A JSON with Updated signature entry
- Documentation Reference:
- get_form_submissions(form_id, limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
form_id – Unique ID of the form
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
person_id – Unique ID of the person
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
form_id – Unique ID of the form
submission_id – Unique ID of the submission
- Returns:
A JSON with the submission entry
- Documentation Reference:
- get_person_submission(person_id, submission_id)[source]¶
- Parameters:
person_id – Unique ID of the submission
submission_id – Unique ID of the submission
- Returns:
A JSON with the submission entry
- Documentation Reference:
- create_submission(form_id, person_id)[source]¶
- Parameters:
form_id – Unique ID of the form
person_id – 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]¶
- Parameters:
form_id – Unique ID of the form
submission_id – Unique ID of the submission
data –
Payload for updating the submission
{ "_links" : { "osdi:person" : { "href" : "https://actionnetwork.org/api/v2/people/id" } } }
- Returns:
A JSON with Updated submission entry
- Documentation Reference:
- get_surveys(limit=None, per_page=25, page=None, filter=None)[source]¶
Survey resources are sometimes presented as collections of surveys. For example, calling the surveys endpoint will return a collection of all the surveys associated with your API key.
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
- get_survey(survey_id)[source]¶
- Parameters:
survey_id – Unique ID of the survey
- Returns:
A JSON with the survey entry
- Documentation Reference:
- create_survey(data)[source]¶
- Parameters:
data –
Payload for creating the survey¶{ "title": "My Free Survey", "origin_system": "FreeSurveys.com" }
OR
Payload for creating the survey with a creator link¶{ "title": "My Free Survey", "origin_system": "FreeSurveys.com" "_links" : { "osdi:creator" : { "href" : "https://actionnetwork.org/api/v2/people/[person_id]" } } }
- Returns:
A JSON with the created survey entry
- Documentation Reference:
- update_survey(survey_id, data)[source]¶
- Parameters:
survey_id – Unique ID of the survey
data –
Payload for updating the survey
{ "title": "My Free Survey", "origin_system": "FreeSurveys.com", }
- Returns:
A JSON with Updated survey entry
- Documentation Reference:
- get_tags(limit=None, per_page=None)[source]¶
- Parameters:
limit – 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]¶
- Parameters:
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]¶
Adds a tag to Action Network. Once created, tags CANNOT be edited or deleted.
- Parameters:
name – Tag’s name. This is the ONLY editable field
- Documentation Reference:
- get_taggings(tag_id, limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
tag_id – Unique ID of the tag
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
tag_id – Unique ID of the tag
tagging_id – Unique ID of the tagging
- Returns:
A JSON with the tagging entry
- Documentation Reference:
- create_tagging(tag_id, payload, background_processing=False)[source]¶
- Parameters:
tag_id – Unique ID of the tag
payload –
Payload for creating the tagging
{ "_links" : { "osdi:person" : { "href" : "https://actionnetwork.org/api/v2/people/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
- Returns:
A JSON response after creating the tagging
- Documentation Reference:
- delete_tagging(tag_id, tagging_id, background_processing=False)[source]¶
- Parameters:
tag_id – Unique ID of the tag
tagging_id – Unique ID of the tagging to be deleted
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
- Returns:
A JSON response after deleting the tagging
- Documentation Reference:
- get_wrappers(limit=None, per_page=25, page=None, filter=None)[source]¶
- Parameters:
limit – Number of entries to return. When None, returns all entries.
per_page – Number of entries per page to return. 25 maximum.
page – Which page of results to return
filter – 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]¶
- Parameters:
wrapper_id – Unique ID of the wrapper
tagging_id – 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]¶
- Parameters:
limit – The maximum number of unique ID lists to return. When None, returns all unique ID lists.
per_page – 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 Unique ID lists.
- Documentation Reference:
- get_unique_id_list(unique_id_list_id)[source]¶
- Parameters:
unique_id_list_id – Unique ID of Unique ID list
- Returns:
A JSON response with Unique ID list details
- Documentation Reference: