The following macros are not currently supported in the header:
  • style

Create Activity

Service Applications

If you are running a service application executing as the default AffinityLive system user, the visibility field will be defaulted to 'all'. Otherwise, the default is 'private'.

Create a new activity

Resource URL 

POST /activities

Parameters

Table of allowed parameters. Underlined parameters are required.

subjectstringActivity's subject that will appear in the title of the activity.
bodystringThe content of the activity.
against_idunsignedThe id of the against_table object, the activity is linked against. This will default to the current user's id.
against_typestringThe object the activity is linked against. This can be: affiliation, annex, campaign, account_invoice, campaign_action, component, contract, contract_period, deployment, event, invoice, issue, job, membership, prospect, request, task or staff. This will default to staff.
owner_typestringThe activity can be owned by a staff member or an affiliation.
owner_idunsignedOwner's id. i.e, the staff or affiliation id of owner_table.
mediumstringType of activity to create. This can be: note, meeting, report, email, call, postal, fax or sms. This will default to note.
visibilitystringThis can be: all, confidential or private. This will default to private.
detailsstringAdditional details assigned to an activity. For meetings and postals this is used to store the location/address. For calls this is used to store the number.
priority_idunsigned 
class_idunsigned 
thread_idunsigned 
task_idunsigned 
parent_idunsignedAnother activity ID
date_startedunix tsSeconds since UTC
date_dueunix tsSeconds since UTC
date_endedunix tsSeconds since UTC
message_idstringCustom message id given to the activity.
nonbillableunsignedAmount of non-billable time ("Logged time") to log against the activity. Requires owner_type of "staff" and an owner_id
billableunsignedAmount of billable time to log against the activity. Note. This field is only for activities against an issue, job, milestone, contract or period. Please use the nonbillable ("logged time") parameter for any other against types. Requires owner_type of "staff" and an owner_id
toassociative arrayAn associative array of staff, affiliations and emails (Requires JSON content type, application/js). For meetings this can also be labelled "attendees" and "including" for calls.
ccassociative arrayAn associative array of staff, affiliations and emails (Requires JSON content type, application/js).
bccassociative arrayAn associative array of staff, affiliations and emails (Requires JSON content type, application/js).
send_invitesbooleanFor meetings you can enable to send invites. Defaults to false, for now invites (Only applicable when "medium" is "meeting").
filefileA file you would like to add as an attachment to the new activity (Requires "multi-part/form-data")
_fieldsstringAllows you to specify optional fields and linked objects to include in the response, if successful.

Logging time

The billable and nonbillable attributes require that you supply a staff owner (owner_type and owner_id) otherwise no time allocation is created against the new activity. i.e, the user who the time belongs to.

Logging activity against a task

To log an activity against a task, you should pass in the task's against_id and against_type as the new activity's against_id and against_type. Essentially you are creating an activity against the object the task is against.

Including to, cc and bcc interactions

Creating an activity including interactions is a simple JSON request. It supports to, cc and bcc. Interaction owners staff, affiliations and general emails. e.g,

curl -XPOST https://yourdeployment.api.affinitylive.com/api/v0/activities -d{
  ...
  "to": {
    "staff": [10]
  },
  "cc": {
    "affiliation": [13,14]
  },
  "bcc": {
    "emails": "bcc-recipient@affinitylive.com"
  }
}

Would create an activity to staff with id 10, cc'ing affiliations 13 and 14 and bcc'ing the email recipient "bcc-recipient@affinitylive.com".

Handling the response

Please see the GET endpoint for handling the response.