Difference between revisions of "Social Networking Service"

From Gcube Wiki
Jump to: navigation, search
(Service Overview)
Line 29: Line 29:
  
 
* text: text of the post;  
 
* text: text of the post;  
* params: additional parameters if your application supports the direct opening of of this update's object e.g. id=12345&type=foo;
+
* params: additional parameters if your application supports the direct opening of of this update's object e.g. id=12345&type=foo [optional];
* previewtitle: a title for the preview of the post;
+
* previewtitle: a title for the preview of the post [optional];
* previewdescription: a description for the preview of the post;
+
* previewdescription: a description for the preview of the post [optional];
* httpimageurl: if you want to put an image, pass its url
+
* httpimageurl: if you want to put an image, pass its url [optional];
 
* token: that must be a valid application token (likely generated by invoking the previous method);
 
* token: that must be a valid application token (likely generated by invoking the previous method);
* enablenotification: a boolean value to enable notifications.
+
* enablenotification: a boolean value to enable notifications [optional];
  
 
For example:
 
For example:

Revision as of 14:58, 17 December 2015

Service Overview

A subset of the social networking library functionalities is now reachable over http. Specifically, the interface allows to generate an application token by which an application is allowed to write on a certain vre and to perform this latter operation.

The Web Service Interface is hosted at the following address (BaseURL): https://dev.d4science.org/social-networking-library-ws/rest/

Please note that only https may be used to access the Web Service Interface.

List of Available Functions

  • tokens/generateApplicationToken
  • feeds/writeFeedApplication
  • feeds/getAllFeedsByApp

Usage

First of all, you need to have a user token for authentication purposes. You can get it using the Service Authentication portlet available on the VRE you are interesting in post in. Now, to get an application token you can invoke the first method. It is an HTTP/POST method, that accepts as parameters:

  • appid: the identifier of the application as reported in the Application Profile;
  • token: a user token generated for the VRE in which you are interesting the application will write in.

You can call it by writing your own REST client application or by using (a lot of) already existent rest client plugins. For example, using the RESTClient plugin for Firefox you will have something like this for requiring a new application token:

GenerateApplicationToken.png

Push on the SEND button and if all it's ok, your application token will be generated and returned as result.

By means of this new token the application can write on the vre for which the token has been previously required. Just invoke the second method, that accepts these parameters:

  • text: text of the post;
  • params: additional parameters if your application supports the direct opening of of this update's object e.g. id=12345&type=foo [optional];
  • previewtitle: a title for the preview of the post [optional];
  • previewdescription: a description for the preview of the post [optional];
  • httpimageurl: if you want to put an image, pass its url [optional];
  • token: that must be a valid application token (likely generated by invoking the previous method);
  • enablenotification: a boolean value to enable notifications [optional];

For example:

WriteApplicationPost.png

Push on SEND and check the result of the method.

In order to retrieve all the feeds the application wrote (in every VRE it is allowed to write in) you can invoke the third (HTTP/GET) method. It accepts only one parameter:

  • token: the only requirement is that it is a valid token for this application.

For example,

BASE_URL/feeds/getAllFeedsByApp?token=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyy