Create Activity
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.

subject

string

Activity's subject that will appear in the title of the activity.

body

string

The content of the activity.

against_id

unsigned

The id of the against_table object, the activity is linked against. This will default to the current user's id.

against_type

string

The 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_type

string

The activity can be owned by a staff member or an affiliation.

owner_id

unsigned

Owner's id. i.e, the staff or affiliation id of owner_table.

medium

string

Type of activity to create. This can be: note, meeting, report, email, call, postal, fax or sms. This will default to note.

visibility

string

This can be: all, confidential or private. This will default to private.

details

string

Additional 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_id

unsigned

 

class_id

unsigned

 

thread_id

unsigned

 

task_id

unsigned

 

parent_id

unsigned

Another activity ID

date_started

unix ts

Seconds since UTC

date_due

unix ts

Seconds since UTC

date_ended

unix ts

Seconds since UTC

message_id

string

Custom message id given to the activity.

nonbillable

unsigned

Amount of non-billable time ("Logged time") to log against the activity. Requires owner_type of "staff" and an owner_id

billable

unsigned

Amount 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

to

associative array

An 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.

cc

associative array

An associative array of staff, affiliations and emails (Requires JSON content type, application/js).

bcc

associative array

An associative array of staff, affiliations and emails (Requires JSON content type, application/js).

send_invites

boolean

For meetings you can enable to send invites. Defaults to false, for now invites (Only applicable when "medium" is "meeting").

file

file

A file you would like to add as an attachment to the new activity (Requires "multi-part/form-data")

_fields

string

Allows 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.