Skip to content

End to End Example Tutorial

Michael Petychakis edited this page May 12, 2015 · 13 revisions

OPENi Framework Example Tutorial


Admin Panel

The easiest way to integrate new CBS for a developer is through the administration panel. Currently it is shared amongst all developers,but it will be customised per user login. Admin Panel for handling CBS First one visits the socialapp tab, chooses to create a new application and then:


Registering a new Application

  1. Chooses the provider from the drop down list.
  2. Creates a name for his application.
  3. He fills the client id field with the App ID, or consumer key.
  4. He then fills the secret key field with the API secret, client secret, or consumer secret.
  5. He selects the domain/site/url that the application is going to be hosted at.
  6. He saves the application.

Registering a new User

  1. Chooses the provider from the drop down list.
  2. Chooses or creates a new user for the platform
  3. Adds the id of the user for the specific platform.

Registering a new Social Token for a User

  1. Chooses the CBS registered application from the drop down list.
  2. Chooses the specific user social account from the drop down list.
  3. He fills the social account field with the “oauth_token” (OAuth1) or access token (OAuth2).
  4. He then fills the token secret field with the “oauth_token_secret” (OAuth1) or refresh token (OAuth2).
  5. He finally can choose to add an expiration date.

Adding Permissions

First the user should ask specific permissions for the objects he would like to authorise at the permissions panel on the cloudlet. For more information have a look at Permission Builder Tutorial


Swagger Interface for Interacting with CBS and Objects

Here is the Swagger Testing Interface for API Platform which can be used to actually interact with the various CBS and the cloudlet in unified calls. All Object calls have an Authorization field as shown in the screenshot. Swagger Interface for Interacting with an Object

You can generate on of the Authorization tokens from the corresponding Swagger Interface or through the administration panel of the cloudlet.


Retrieving all statuses from Twitter


Setting up the Request on the Swagger Interface Setting up the Request on the Swagger Interface

The Response of the Request as shown on Swagger The Response of the Request as shown on Swagger

The Actual Response

{ "cbs": [ { "meta": { "limit": null, "next": null, "offset": 0, "previous": null, "total_count": 20 }, "objects": [ { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 597717858458570800, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "Should I pay a visit on the 6th Annual #InternetofThings European Summit? - http://t.co/ktNmxqYgiK #IoT", "time": { "created_time": "Mon May 11 11:00:17 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 597672509182505000, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "Back to work after a nice week in #Barcelona, full of #API discussions thanks to @apidaysMedit. Real life #HappensNow", "time": { "created_time": "Mon May 11 08:00:05 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 597345365998891000, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "RT @juanantoniobm: @planetpython \nEight out of the top 10 universities now use Python to introduce programming.\nhttp://t.co/Vxzru3cXKx\n@mpe…", "time": { "created_time": "Sun May 10 10:20:08 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 597334668069969900, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "RT @JuleenRZierath: \"In Order to Think Out of the Box, You Need to Have a Box in the First Place\" Thomas C. Südhof @StanfordMed http://t.co…", "time": { "created_time": "Sun May 10 09:37:37 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 596402151259295700, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "RT @orliesaurus: @mpetyx @apidaysMedit @Giorgosps avte gie mou! lets make it happen :D", "time": { "created_time": "Thu May 07 19:52:08 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 596393479284076500, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "@apidaysMedit it's a promise!! @Giorgosps will make it happen! #APIdaysBCN", "time": { "created_time": "Thu May 07 19:17:40 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 596393078228914200, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "RT @apidaysMedit: @mpetyx :__) next station, APIdays Mikonos?", "time": { "created_time": "Thu May 07 19:16:04 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" }, { "from": { "id": 95257276, "name": "Michael Petychakis", "object_type": "user", "resource_uri": "http://t.co/LznjMxoO7e" }, "id": 596388387705253900, "object_type": "status", "resource_uri": "", "service": "twitter", "text": "RT @openi_ict: So nice to have a relaxing beer with all the #API artisans after a couple of crazy #API days! Say hi to @romdim and @mpetyx…", "time": { "created_time": "Thu May 07 18:57:26 +0000 2015", "deleted_time": "", "edited_time": "" }, "title": "" } ] } ], "cloudlet": { "meta": { "limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 0 }, "objects": [] } }

Post A new Status on Cloudlet and Twitter

curl -X POST -H "Content-Type: application/json" -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJtcGV0eXhfNmUxMDM0YzctYTc3Ni00NjQ3LTg3YzctOGViNWQ0NTY3YzU2IiwiaXNzIjoiaHR0cHM6Ly9kZW1vMi5vcGVuaS1pY3QuZXUvYXV0aC90b2tlbiIsInN1YiI6Im1wZXR5eCIsImV4cCI6MTQzMTQ3NDAyOCwiaWF0IjoxNDMxNDMwODI4LCJub25jZSI6IjExZjRkZmE0LWE4MzgtNDBiOS05NGM2LWUxZGM3ODNmOWJhOCIsInVzZXJfaWQiOiJtcGV0eXgiLCJjbG91ZGxldCI6ImNfMGMzZWY5ZTk5YjUzNzY5Y2EwMjZlMTFjYTIyMWQ5ZDgiLCJzY29wZSI6Im9wZW5pIiwib3BlbmktdG9rZW4tdHlwZSI6InNlc3Npb24iLCJyZXNwb25zZV90eXBlIjoiaWRfdG9rZW4ifQ.f2jqrBB5BdMPgUigWgmXQSvgg7bqr80qrlmOlNvIGIgswJulsSheR_CX8YYon2oqPA4nzuy8B7yZ6OSYNdroug" -H "Cache-Control: no-cache" -H "Postman-Token: c9457ed0-94bf-46f5-a432-4d01899a515b" -d '{ "text": "my dummy post", "context": {}, "title": "" }' https://demo2.openi-ict.eu:443/v.04/Status/?cbs=['twitter']&message="my dummy post"&user="dev"&text="my dummy post"