GET https://:subdomain.cobot.me/api/activities?from=<time>&to=<time>
Returns a list of activities for the given timespan.
Activities are things like new members, invoices created, payments failed etc. They are equivalent to what you see on the dashboard.
Each activity has a time, a type and its own set of meta data.
Optionally you can pass a types
parameter with a comma separated list of the activity types you are interested in.
Instead of from
/to
/types
, you can also pass in source_ids
as a comma separated list of ids. This will only return activities associated with these objects (e.g. memberships, invoices).
Yet another alternative is to pass a parameter last=n
- this returns the last n
activities for the space.
GET https://co-up.cobot.me/api/activities?from=2014-02-12 0:00:00 +0000&to=2014-02-19 23:59:59 +0000
Response:
[ { "created_at": "2014/04/01 00:01:02 +0000", "type": "new_invoice", "channels": ["admin"], "attributes": { "invoice_number": 11946, "invoice_id": "c09ff169a8832f6155ed72cbc6348b87", "amount": "95.0", "currency": "EUR", "membership_id": "2a7824285bc7eb3cd2d1c1e0d6f14303", "membership_name": "Joe Doe" } }, { "created_at": "2014/04/01 08:42:05 +0000", "type": "plan_change", "channels": ["admin"], "attributes": { "old_plan_name": "Part-time", "new_plan_name": "Full-time", "change_date": "2014-04-17", "new_plan_extras": [], "old_plan_price": "88.23", "new_plan_price": "163.86", "old_plan_currency": "EUR", "new_plan_currency": "EUR", "membership_id": "64141d5dcb25b1904eafbc46410f2587", "membership_name": "Jane Doe" } } ]
You can also request a list of activities as HTML by setting the Accept
header in your request to text/html
.
Response:
<ul> <li data-id="a10d3169a8832f6155ed72cbc6348b77" data-created-at="2014/04/01 00:01:02 +0000" data-type="new_invoice" data-level="WARN" > Created <a href="http://co-up.cobot.me/admin/invoices/1">invoice 1</a> (10.00 EUR) for <a href="http://co-up.cobot.me/admin/memberships/m1">Joe</a>. </li> </ul>
POST https://:subdomain.cobot.me/api/activities
POST https://co-up.cobot.me/api/activities
Request:
{ "text": "Some text about your activity.", "level": "ERROR", "channels": ["admin", "membership"], "source_ids": ["f5ed7a30-3edb-5ac2-bca4-d80e20ecb096"] }
Response:
{ "created_at": "2013/05/04 12:00:00 +0000", "type": "text", "channels": ["admin", "membership"], "level": "ERROR", "attributes": { "text": "Some text about your activity." } }