Warning

The XML-RPC API is deprecated, and will be removed on July 1, 2023.

Please use the REST API instead.

Contact support if you need help with migration, or need the feature enabled on a transitional basis.

Actions

Actions are, unsurprisingly, at the heart of ActionKit. Actions are the record of a person, a User, doing some thing. Those things are represented by Pages. Pages are just a funny name for things a User can do. For example, a PetitionPage let's a User sign a petition; a DonationPage let's a User give a donation.

You can use the API to process actions that Users take on your site, or to retrieve information about a User's previous actions. For more on processing actions see Processing User Actions

Finding User Actions

Aside from processing actions, you can query ActionKit to find out what Actions a User has already taken.

You can use the base class to get a full list of actions:

>>> actionkit = Server('https://%s:%s@%s/api/' % (user,password,host))

>>> user = actionkit.User.get({'akid': akid})
>>> history = actionkit.Action.search({'user': user['id']})
[{'status': 'complete', 'user_id': 2, 'action_ptr_id': 3, 'referring_mailing_id': None, 'mailing_id': None, 'opq_id': '', 'created_at': '2009-09-26T10:10:09', 'updated_at': '2009-09-26T10:10:09', 'source': 'website', 'created_user': 1, 'link': None, 'subscribed_user': 1, 'referring_user_id': None, 'page_id': 6, 'id': 3}]

or a specific action type to limit the search:

>>> history = actionkit.PetitionAction.search({'user': user['id']})
[]

or a specific Page to limit the search even more:

>>> history = actionkit.PetitionAction.search({'user': user['id'], 'page__name': 'everyhome' })
[]

Custom Action Fields

If the Action was processed with custom fields, the returned Actions will have a 'custom_fields' field.

Example:

>>> history = actionkit.Action.get({id: 3})
{'status': 'complete', 'user_id': 2, 'action_ptr_id': 3, 'referring_mailing_id': None, 'mailing_id': None, 'opq_id': '', 'created_at': '2009-09-26T10:10:09', 'updated_at': '2009-09-26T10:10:09', 'source': 'website', 'created_user': 1, 'link': None, 'subscribed_user': 1, 'referring_user_id': None, 'page_id': 6, 'id': 3, 'custom_fields': { 'partner': 'buddy' }}

You can get and set custom fields on Actions directly:

>>> fields = actionkit.Action.set_custom_fields({'id': action['id'], 'partner': 'buddy'})
{ 'partner': 'buddy' }

>>> fields = actionkit.Action.get_custom_fields({'id': action['id']})
{ 'partner': 'buddy' }

>>> fields = actionkit.Action.clear_custom_fields({'id': action['id']})
{}