0

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();
        }
bukubapi
  • 497
  • 2
  • 5
  • 13

1 Answers1

0

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"

    }
Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • I am able to post the first EE event in the ActivityStream. When an action is taken on that event by the user, I need to update the entry with actionable=false, so that it automatically gets removed from the Action Required stream/group. – bukubapi Dec 16 '14 at 05:10
  • Added the code snippet that I am using. It gives me an error Caused by: com.ibm.commons.util.io.json.parser.TokenMgrError: Lexical error at line 1, column 1. Encountered: "<" (60), after : "" – bukubapi Dec 16 '14 at 06:31
  • String url = "https://mydomain.com/connections/opensocial/rest/activitystreams/@me/@all/@all/" don't use this URL, follow the model in the example above... what you've done is make a url like this String url = "https://mydomain.com/connections/opensocial/rest/activitystreams/https://mydomain.com/connections/opensocial/rest/activitystreams/@me/@all/@all/"; ... the rendering issue is on the error screen you get back from the service as the default HTML is telling you it doesn't exist – Paul Bastide Dec 16 '14 at 12:14
  • Can you please help me by providing an example or pointing to some. Apologies, I couldn't fully comprehend your message – bukubapi Dec 16 '14 at 13:04
  • specifically follow this example https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaSnippets.xsp#snippet=Social_ActivityStreams_Post_Event_With_Embedded_Experience you do not need to pass in a URL. what you did is send it to an invalid URL, and the response wasn't parsed as it's not JSON content, it's a plain HTML page as the URL does not exist – Paul Bastide Dec 16 '14 at 13:43
  • Without the url I get the following error: Caused by: com.ibm.sbt.services.client.ClientServicesException: Request to url https://mydomain.com/connections/opensocial/basic/rest/activitystreams/%40me/%40all/%40all returned an error response 400:Bad Request HTTP/1.1 400 Bad Request – bukubapi Dec 18 '14 at 09:02
  • try first copying and running the exact sample referenced above. if that works, then you can follow the model to add the actionable:true child jsonjavaobject – Paul Bastide Dec 19 '14 at 12:38