GET /api/v1/activities
List activities

Examples

GET /foundry-api/v1/activities
200
{
  "data": [
    {
      "id": "47",
      "type": "activities",
      "links": {
        "self": "http://test.host/foundry-api/v1/activities/47"
      },
      "attributes": {
        "key": "insight.view",
        "created-at": "2017-08-29T10:44:24.092+08:00",
        "anonymize": false,
        "origin": "smartkarma",
        "parameters": {}
      },
      "relationships": {
        "trackable": {
          "links": {
            "self": "http://test.host/foundry-api/v1/activities/47/relationships/trackable",
            "related": "http://test.host/foundry-api/v1/activities/47/trackable"
          }
        },
        "owner": {
          "links": {
            "self": "http://test.host/foundry-api/v1/activities/47/relationships/owner",
            "related": "http://test.host/foundry-api/v1/activities/47/owner"
          }
        },
        "recipient": {
          "links": {
            "self": "http://test.host/foundry-api/v1/activities/47/relationships/recipient",
            "related": "http://test.host/foundry-api/v1/activities/47/recipient"
          }
        }
      }
    }
  ],
  "meta": {
    "total-pages": 1,
    "record-count": 1
  },
  "links": {
    "first": "http://test.host/foundry-api/v1/activities?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "last": "http://test.host/foundry-api/v1/activities?page%5Bnumber%5D=1&page%5Bsize%5D=10"
  }
}

POST /api/v2/activities
Create an activity

Examples

POST /api/v2/activities
{
  "data": {
    "type": "activities",
    "attributes": {
      "key": "comment.view_thread",
      "created-at": null,
      "anonymize": false,
      "origin": "smartkarma",
      "parameters": {},
      "direction": null
    },
    "relationships": {
      "trackable": {
        "data": {
          "type": "comments",
          "id": "1"
        }
      }
    }
  }
}
201
{
  "data": {
    "id": "106",
    "type": "activities",
    "links": {
      "self": "http://test.host/api/v2/activities/106"
    },
    "attributes": {
      "key": "comment.view_thread",
      "created-at": "2017-08-29T10:44:38.160+08:00",
      "anonymize": false,
      "origin": "smartkarma",
      "parameters": {},
      "direction": "outgoing"
    },
    "relationships": {
      "trackable": {
        "links": {
          "self": "http://test.host/api/v2/activities/106/relationships/trackable",
          "related": "http://test.host/api/v2/activities/106/trackable"
        }
      },
      "owner": {
        "links": {
          "self": "http://test.host/api/v2/activities/106/relationships/owner",
          "related": "http://test.host/api/v2/activities/106/owner"
        }
      },
      "recipient": {
        "links": {
          "self": "http://test.host/api/v2/activities/106/relationships/recipient",
          "related": "http://test.host/api/v2/activities/106/recipient"
        }
      }
    }
  }
}

Params

Param name Description
data
required

Activity information

Validations:

  • Must be a Hash

data[key]
required

Activity key

Validations:

  • Must be a String

data[parameters]
optional

Additional information needed to be stored

Validations:

  • Must be a Hash

data[relationships]
required

Validations:

  • Must be a Hash

data[relationships][trackable]
required

Validations:

  • Must be a Hash

data[relationships][trackable][data]
required

Validations:

  • Must be a Hash

data[relationships][trackable][data][type]
required

Trackable type

Validations:

  • Must be a String

data[relationships][trackable][data][id]
required

Trackable ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.


GET /api/v1/activities/:id
Show an activity

Params

Param name Description
id
required

Activity ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.