Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

/channel/{channel_id}

Modifies a specific channel or returns all channels when no ID is provided during GET

Note: will return the scoring stats for a channel except when you don't provide a channel_id

Note: you may only create a channel while you have room according to your max_number_of_channels field in your settings object

Possible Methods

GET POST PUT DELETE

Arguments

channel_id (optional for GET, required otherwise)
Channel to modify or return, if not provided during GET call will return all channels.

Json Object
{
        "channel_id" : "531733e8b8e08e9d2197b0b0",	//REQUIRED: either here or in url (except for GET if you want all channels)
        "events" : [],								//ONLY IN RESPONSE
        "locations" : [],							//ONLY IN RESPONSE
        "name" : "abc123",							//OPTIONAL: required for POST, can be used in PUT to change name
		"index" : 4,								//OPTIONAL: used in gui for ordering, if not provided won't be set
		"created_date" : "May 2, 2014 09:00:36 PM UTC" //OPTIONAL: will be set if not provided in POST
 }

 

Example
curl -b cookies.txt -X GET "http://localhost:8185/channel" > response.txt
curl -b cookies.txt -X GET "http://localhost:8185/channel/531733e8b8e08e9d2197b0b0" > response.txt
curl -b cookies.txt -X POST -d '{"name":"abc123"}'  "http://localhost:8185/channel" > response.txt
curl -b cookies.txt -X PUT-d '{"name":"renamed my channel"}'  "http://localhost:8185/channel/531733e8b8e08e9d2197b0b0" > response.txt
curl -b cookies.txt -X PUT-d '{"channel_id":"531733e8b8e08e9d2197b0b0", "name":"renamed my channel"}'  "http://localhost:8185/channel" > response.txt
curl -b cookies.txt -X DELETE -d '{"channel":"531733e8b8e08e9d2197b0b0"}'  "http://localhost:8185/channel" > response.txt
curl -b cookies.txt -X DELETE "http://localhost:8185/channel/531733e8b8e08e9d2197b0b0" > response.txt

 

Example Response
curl -b cookies.txt -X PUT -d '{"name":"search test1"}' "http://localhost:8185/channel/53455c56e4b020ab310aeb9c" > response.txt

 

{
    "response": {
        "action": "Channel",
        "success": true,
        "message": "Updated a channel",
        "time": 0
    },
    "data": {
        "channel_id": "53455c56e4b020ab310aeb9c",
        "name": "search test1",
        "locations": [],
        "events": [
            {
                "event_id": "52685513e4b0876bf2371389",
                "liked": false,
                "timestamp": "Apr 9, 2014 02:43:16 PM UTC"
            },
            {
                "event_id": "52737684e4b02ca0170e6442",
                "liked": false,
                "timestamp": "Apr 9, 2014 02:48:33 PM UTC"
            },
            {
                "event_id": "5281b1eae4b068d945ff0f7a",
                "liked": true,
                "timestamp": "Apr 9, 2014 06:33:28 PM UTC"
            },
            {
                "event_id": "527e6550e4b0e6c5bceb1760",
                "liked": true,
                "timestamp": "Apr 9, 2014 06:33:31 PM UTC"
            }
        ],
        "score": {
            "entities": {
                "winning ticket/keyword": 1,
                "sugarplumpie/twitteruser": -2,
                "winning number/keyword": 1,
                "greece/place": -2,
                "3040 foothill blvd/road": 1,
                "liquor store/keyword": 1,
                "social media/topic": -2,
                "new york, ny, united states/city": -1,
                "million lottery ticket/keyword": 1,
                "$1 million/currency amount": 2
            },
            "tags": {
                "October": -1,
                "db": 1,
                "Staten": -1,
                "Brooklyn": -1,
                "November": -1,
                "York": -1,
                "New": -1,
                "NYC": -1,
                "Island": -1,
                "Twitter": -1
            }
        }
    }
}
curl -b cookies.txt -X GET "http://localhost:8185/channel" > response.txt
 {
    "response": {
        "action": "Channel",
        "success": true,
        "message": "Returned all channels",
        "time": 0
    },
    "data": {
        "channels": [{
            "channel_id": "531733e8b8e08e9d2197b0b0",
            "name": "abc123",
            "locations": [{
                "location_id": "53179986b8e06656d5398b49",
                "latitude": 23.7,
                "longitude": 67.2,
                "radius": 22.0,
                "timestamp": "Mar 5, 2014 09:39:18 PM UTC"
            },
            {
                "location_id": "53179990b8e06656d5398b4a",
                "latitude": 23.7,
                "longitude": 67.2,
                "radius": 676.0,
                "timestamp": "Mar 5, 2014 09:39:28 PM UTC"
            }],
            "events": [{
                "event_id": "53146705e4b056d7c3c22ed8",
                "liked": true,
                "timestamp": "Mar 5, 2014 10:22:18 PM UTC"
            },
            {
                "event_id": "53146705e4b056d7c3c22ed8",
                "liked": true,
                "timestamp": "Mar 6, 2014 02:09:51 PM UTC"
            }]
        }]
    }
}
  • No labels