Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
/channel/{channel_id}
Info

Retrieves Modifies a specific channel or returns all channels available to the user if channel_id is not provided.when no ID is provided during GET

Possible Methods

GET POST PUT DELETE

...

Code Block
{
        "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
}

 

Example
Code Block
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
Info
CALL: curl -b cookies.txt -X GET "http://localhost:8185/channel" > response.txt
Code Block
 {
    "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"
            }]
        }]
    }
}