Pipeless

Documentation

Recent Activity

Get recent user activity related to a specific item (account, product, tag, post, video, etc.). For a target object, this algorithm pulls the most recent user actions on that object.

Examples include:

  • People who liked this video
  • Recent comments on this post
  • Recent #travel photos
  • New followers to this channel
  • Accounts who shared this article

Code Example

Take a look at this example of using the Recent Activity endpoint, and read the detailed description below explaining each part of this code.

const data = JSON.stringify({
  "object": {
    "id": "David",
    "type": "user"
  }
});

const xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.pipeless.io/v1/apps/123/algos/activity/object");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
import requests

url = "https://api.pipeless.io/v1/apps/123/algos/activity/object"

payload = {"object": {
        "id": "David",
        "type": "user"
    }}
headers = {
    "accept": "application/json",
    "content-type": "application/json"
}

response = requests.request("GET", url, json=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.pipeless.io/v1/apps/123/algos/activity/object")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"object\":{\"id\":\"David\",\"type\":\"user\"}}"

response = http.request(request)
puts response.read_body
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/algos/activity/object",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "{\"object\":{\"id\":\"David\",\"type\":\"user\"}}",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"object\":{\"id\":\"David\",\"type\":\"user\"}}");
Request request = new Request.Builder()
  .url("https://api.pipeless.io/v1/apps/123/algos/activity/object")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
curl --request GET \
  --url https://api.pipeless.io/v1/apps/123/algos/activity/object \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"object":{"id":"David","type":"user"}}'

Here we're running this algo on App ID "123" where an object user "David" is being used to view David's recent activity (e.g. liking certain content or following specific users. There are more optional controls you can explore in the API reference docs like limiting the recent activity to certain relationships, for instance, if you only wanted to show the recent posts David has liked).

To summarize, this example is: "get activity David has recently engaged in"

Tutorial Example

You can see this API endpoint in action using our tutorial restaurant dataset here:
Recent Activity Tutorial Example

Community How-To's

Build a social network on top of your website

API Reference Documentation

You can read the reference docs for this endpoint here:
Get Activity on Object

Updated 4 months ago


What's Next

Following Feed

Recent Activity


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.