Steren edited this page Aug 5, 2011 · 17 revisions

This wiki is dedicated to help developers use the Beansight API.

Introduction

The Beansight API is designed to interact with the content from Beansight.

You can call the Beansight API from a server, a mobile application or browser-side.

You will find on this page a generated reference, it will be your best ally when calling the API. We also built some code samples for you to start from.

Reference

All the actions and parameters are listed on the references of each objet type:

Samples

You will find working code examples in the beansight-api github repository:

  • a browser-side API call using javascript
  • an Android application making an API call

Getting started

Response

Every response is given in JSON. The returned JSON object looks like { "response":{...}, "meta":{"authenticated":true, "userName":"foo"} }.

  • All the requested data are stored in response.
  • The meta gives you additional information. For example, you always know if the user is connected and if so, what is his unique userName.

ID

Insights are identified by an unique string (id), generated from the insight content. Example: devs-will-build-awesome-apps-using-beansight-api. Users are identified by an unique username (userName).

Authorization and Access Token

For now, you can call the Beansight API without having to register your application. If you call actions that require user login (agree or disagree for example), you will need to get an access token.

To get an access token, your user must login on the authenticate page at the URL: http://www.beansight.com/api/authenticate

By default after authenticating successfully the web browser will be redirected to http://www.beansight.com/api/authenticateSuccess and will provide the access token in the url after the question mark.

Here's an example of a url after a successful authentication using http://www.beansight.com/api/authenticateSuccess :

http://www.beansight.com/api/authenticateSuccess?access_token=7527f624-a7b8-489c-acad-91baf065018f

Authentication url can take two parameters to personalize its behavior :

  • urlCallback : to provide your own url to be used as a callback
  • tokenResultType=fragment: to tell beansight that you want access_token parameter to be provided as a fragment (/api/authenticateSuccess#access_token=7527f624-a7b8-489c-acad-91baf065018f) and not a question mark (/api/authenticateSuccess?access_token=7527f624-a7b8-489c-acad-91baf065018f)
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.