How to use ActivityStreamService to change actionable=false

141 Views Asked by At

An application of mine creates an entry into ActivityStream of IBM Connections with attribute actionable=true. When an action is taken by the user on that post, the post should automatically be removed from the Actionable category.

For that we will have to do a PUT on the ActivityStream using the eventId with actionable=false. Can the put be done using the ActivityStreamService.

PS: I am using SBT and ActivitySTreamService to POST into the IBM Connections Activity Stream

    ActivityStreamService svc = new ActivityStreamService(ep);


        JsonJavaObject payload = new JsonJavaObject();
        payload.putString("id", "");
        payload.putString("verb", "");

        JsonJavaObject actor = new JsonJavaObject();
        actor.putString("id", "");
        payload.putObject("actor", actor);

        JsonJavaObject object = new JsonJavaObject();
        object.putString("id", "");
        payload.putObject("object", object);

        JsonJavaObject connections = new JsonJavaObject();
        connections.putString("actionable", "false");
        payload.putObject("connections", connections);

        String entryId = "urn:lsid:lconn.ibm.com:activitystreams.story:69f632f4-b68d-4cef-84f5-d6267a200e9a";
        String url = "https://mydomain.com/connections/opensocial/rest/activitystreams/@me/@all/@all/";


        try {
            svc.postEntry(url + "/" + entryId + "?X-HTTP-Method-Override=PUT", payload);
        } catch (ActivityStreamServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
1

There are 1 best solutions below

7
On

You always have the option to self assemble the JsonJavaObject.

An example is here. https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaSnippets.xsp#snippet=Social_ActivityStreams_Post_Event_With_Embedded_Experience

All you need to do is add a second child JsonJavaObject

"connections":{

        "actionable":"true"

    }