Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

The nSight API is currently hosted at: http://nsight-api-1.rr.ikanow.com/nsight/

nContext API Overview

This page houses the documentation for the nContext API calls.  This initial page talks about how to interact w/ the API and then each specific API page details what the api call does and the necessary parameters.

Authorization to use the API

Interacting with the nContext API requires a user to login via the auth/login call.  This call will return a cookie and the response will have a token (as well as the "inf_token" header being set.  Either can be used to make subsequent calls against this API.   If you wish to use the token, return it in the header "inf_token" or "Authorization".  The header always overrides any cookies found.

Interaction with the API

All API calls are RESTful and the available HTTP methods for each call are detailed in the table to the right.  Once you've logged in in the previous step you should be able to access any of the API calls.  Many of the calls allow for multiple ways to interact where you can provide and id field in the url or in the JSON payload.  Both ways will result in returning the same data.  If an ID field is not provided the API will attempt to return all matching objects when possible.  For example the Channel call can be used to get a specific channel when you pass an ID with the call, or you can get all channels by not providing an ID field.

Calls that modify collections of a previous call require the ID to be provided in the url (for example channel/{channel_id}/events).

Examples of interacting with the API:

Here are some provided examples in cURL on how to access the API:

Code Block
//STEP 1: Login to Infinit.e and store cookie
curl -c cookies.txt http://nsight-api-1.rr.ikanow.com/nsight/api/auth/login/user@ikanow.com/encoded_password

//STEP 2: Make any nContext API calls you want, while passing the stored cookies
//For example we can create a channel, then add a liked event to it
curl -b cookies.txt -X POST -d '{"name":"channel 1 news"}'  "http://nsight-api-1.rr.ikanow.com/nsight/channel" > response.txt
curl -b cookies.txt -X POST -d '{ "event_id":"53146705e4b056d7c3c22ed8", "liked":true}' "http://nsight-api-1.rr.ikanow.com/nsight/channel/531733e8b8e08e9d2197b0b0/events" > response.txt

//We can make changes by using PUT requests w/ the fields we want to change
curl -b cookies.txt -X PUT -d '{"name":"world news one"}'  "http://nsight-api-1.rr.ikanow.com/nsight/channel/531733e8b8e08e9d2197b0b0" > response.txt

//STEP 3: Logout from Infinit.e when you are done (this is optional, session will end in 30m of last activity)
curl -b cookies.txt http://nsight-api-1.rr.ikanow.com/nsight/api/auth/logout


//HEADER EXAMPLE replacement for STEP 2
curl -H "inf_token=53146705e4b056d7c3c22ed8" -X POST -d '{"name":"channel 1 news"}'  "http://nsight-api-1.rr.ikanow.com/nsight/channel" > response.txt

API Calls

 

Search this documentation

Live Search
spaceKeyNCON

{
    "response": {
        "action": "Share",
        "success": true,
        "message": "Returned all pending channels, response to them with /share/{channel_id}/true|false",
        "time": 0
    },
    "data": [
        {
            "channel_id": "5366765cb8e06a28b089254d",
            "name": "sharetest3",
            "locations": [],
            "events": [
                {
                    "event_id": "5339b24ae4b0486192fa825c",
                    "liked": false,
                    "timestamp": "May 4, 2014 05:06:25 PM UTC"
                }
            ],
            "created_date": "May 4, 2014 05:06:03 PM UTC",
            "index": 4
        },
        {
            "channel_id": "53667749b8e078fe62000346",
            "name": "sharetest3",
            "locations": [],
            "events": [
                {
                    "event_id": "5339b24ae4b0486192fa825c",
                    "liked": false,
                    "timestamp": "May 4, 2014 05:06:25 PM UTC"
                }
            ],
            "created_date": "May 4, 2014 05:06:03 PM UTC",
            "index": 4
        },
        {
            "channel_id": "536677acb8e087f918b3600c",
            "name": "sharetest3",
            "locations": [],
            "events": [
                {
                    "event_id": "5339b24ae4b0486192fa825c",
                    "liked": false,
                    "timestamp": "May 4, 2014 05:06:25 PM UTC"
                }
            ],
            "created_date": "May 4, 2014 05:06:03 PM UTC",
            "index": 4
        },
        {
            "channel_id": "536677c6b8e0c2aa07c56730",
            "name": "sharetest3",
            "locations": [],
            "events": [
                {
                    "event_id": "5339b24ae4b0486192fa825c",
                    "liked": false,
                    "timestamp": "May 4, 2014 05:06:25 PM UTC"
                }
            ],
            "created_date": "May 4, 2014 05:06:03 PM UTC",
            "index": 4
        }
    ]
}