Release-0.20-doc

= Exchange protocol v0.20 =

We use "JSON":http://json.org as protocol between client and server. All interaction occur over HTTP. To send request means send HTTP request with needed parameters.

Subscribe channel
Request should be http://tracks.osll.spb.ru:81/service/subscribe {   "description": "Subscribe to channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Availablechannels list
Request should be http://tracks.osll.spb.ru:81/service/channels {     "description": "Avavilable channels", "type": "object", "properties": { "auth_token": {"type":"string"}, "latitude": {"type":"number"}, "longitude": {"type":"number"}, "radius": {"type":"number"} } }

Response with channels list. {   "description": "channels list", "type": "object", "properties": { "errno": {"type":"number"}, "channels": { "type": "array", "items": { "type": "object", "description": "Channel", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "tags": { "type": "array", "items": { "type" : "string" } }               }            }        }    } }

Subscribed channels.
Request should be http://tracks.osll.spb.ru:81/service/subscribed {     "description": "Subscribed channels", "type": "object", "properties": { "auth_token": {"type":"string"} } }

Response with channels list. {   "description": "channels list", "type": "object", "properties": { "errno": {"type":"number"}, "channels": { "type": "array", "items": { "type": "object", "description": "Channel", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "tags": { "type": "array", "items": { "type" : "string" } }               }            }        }    } }

LoadTags
Load nearest tags, sorted by channels Request should be http://tracks.osll.spb.ru:81/service/loadTags {     "description": "RSS", "type": "object", "properties": { "auth_token": {"type":"string"}, "latitude": {"type":"number"}, "longitude": {"type":"number"}, "radius": {"type":"number"}, "type": {"type":"string", "optinal":true} } }

type:
 * "full" : display all marks, set by default;
 * "last_one" : display last mark, from each channel member

Response with tags {   "description": "rss", "type": "object", "properties": { "errno": {"type":"number"}, "rss": { "type": "object", "properties": { "channel": { "type": "object", "properties": { "title": {"type": "string"}, "link": {"type": "string"}, "description": {"type": "string"}, "language": {"type": "string"}, "pubDate": {"type": "string"}, "item": { "type": "array", "items": { "type": "object", "properties": { "title": {"type": "string"}, "link": {"type": "string"}, "channel": {"type": "string"}, "description": {"type": "string"}, "pubDate": {"type": "string"}, "user": {"type": "string"}, "tags": { "type": "array", "items": {"type": "string"} },                                   "altitude" : {"type": "number"}, "latitude" : {"type": "number"}, "longitude" : {"type": "number"} }                           }                        }                    }                }            }        }    } }

Apply mark
Request should be http://tracks.osll.spb.ru:81/service/apply {   "description": "Apply the mark", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"}, "title": {"type": "string"}, "link": {"type": "string"}, "description": {"type": "string"}, "latitude": {"type":"number"}, "altitude": {"type":"number"}, "longitude": {"type":"number"}, "time":{"type":"string"}, "user_time": {"type":"string", "optinal":true} } }

Response

{   "description": "response", "type": "object", "properties": { "mark_id": {"type":"number"}, "errno": {"type":"number"} } }

Apply channel
Request should be http://tracks.osll.spb.ru:81/service/addChannel {   "description": "Add new channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "name":{"type":"string"}, "description": {"type": "string"}, "url": {"type": "string"}, "activeRadius": {"type":"number"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Unsubscribe channel
Request should be http://tracks.osll.spb.ru:81/service/unsubscribe {   "description": "Unsubscribe to channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Login
Request should be http://tracks.osll.spb.ru:81/service/login {   "description": "Login", "type": "object", "properties": { "login": {"type":"string"}, "password":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "auth_token": {"type":"string"} } }

Add user
Request should be http://tracks.osll.spb.ru:81/service/addUser {   "description": "Add new user", "type": "object", "properties": { "email": {"type":"string"}, "login": {"type":"string"}, "password":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "auth_token": {"type":"string"} } }

Register user
Request should be http://tracks.osll.spb.ru:81/service/registerUser {   "description": "Register new user", "type": "object", "properties": { "email": {"type":"string"}, "login": {"type":"string"}, "password":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, } }

Quit session
Request should be http://tracks.osll.spb.ru:81/service/quitSession {   "description": "Quit from session", "type": "object", "properties": { "auth_token": {"type":"string"}, } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, } }

Circle
Search function like this: list = S (dt, x, y, R), where dt - delta of time; Request should be http://tracks.osll.spb.ru:81/service/filterCircle

Request: {	"description": "CircleFilter", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "longitude":{"type":"number"}, "latitude":{"type":"number"}, "radius":{"type":"number"} } }

Response: look at the default filter response (FilterDefaultResponse).

Rectangle
Search function like this: list = S (dt, dx, dy), where dt - delta of time; Request should be http://tracks.osll.spb.ru:81/service/filterRectangle

Request: {	"description": "RectangleFilter", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "latitude_shift": {			"type":"object", {				"latitude1":{"type":"number"}, "latitude2":{"type":"number"}, }

},		"longitude_shift": {			"type":"object", {				"longitude1":{"type":"number"}, "longitude2":{"type":"number"}, }

} 	} }

Response: look at the default filter response (FilterDefaultResponse).

Polygon
Search function like this: list = S (dt, list), where dt - delta of time; Request should be http://tracks.osll.spb.ru:81/service/filterPolygon

Request: {	"description": "PoligonFilter", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "polygon": {			"type":"array", {				"number":{"type":"number"}, "latitude":{"type":"number"}, "longitude":{"type":"number"} }		} 	} }

Response: look at the default filter response (FilterDefaultResponse).

Cylinder
Search function like this: list = S (dt, x, y, R, dh), where dt - delta of time, dh - delta of height; Request should be http://tracks.osll.spb.ru:81/service/filterCylinder

Request: {	"description": "CylinderFilter", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "radius":{"type":"number"}, "longitude":{"type":"number"}, "latitude":{"type":"number"}, "altitude_shift": {			"type":"object", {				"altitude1":{"type":"number"}, "altitude2":{"type":"number"}, }		} 	} }

Response: look at the default filter response (FilterDefaultResponse).

Box
Search function like this: list = S (dt, dx, dy, dz), where dt - delta of time, dh - delta of height; Request should be http://tracks.osll.spb.ru:81/service/filterBox

Request: {	"description": "Box", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "latitude_shift": {			"type":"object", {				"latitude1":{"type":"number"}, "latitude2":{"type":"number"}, }

},		"longitude_shift": {			"type":"object", {				"longitude1":{"type":"number"}, "longitude2":{"type":"number"}, }

}		"altitude_shift": {			"type":"object", {				"altitude1":{"type":"number"}, "altitude2":{"type":"number"}, }		} 	} }

Response: look at the default filter response (FilterDefaultResponse).

Fence
Search function like this: list = S (dt, list, dh), where dt - delta of time, dh - delta of height; Request should be http://tracks.osll.spb.ru:81/service/filterFence

Request: {	"description": "Fence", "type": "object", { 		"auth_token":{"type":"string"}, "time_from":{"type":"string"}, "time_to":{"type":"string"}, "polygon": {			"type":"array", {				"number":{"type":"number"}, "latitude":{"type":"number"}, "longitude":{"type":"number"} }		},		"altitude_shift": {			"type":"object", {				"altitude1":{"type":"number"}, "altitude2":{"type":"number"}, }		} 	} }

Response: look at the default filter response (FilterDefaultResponse).

FilterDefaultResponse - Common response for all filtration requests (default filter response).
List of tags Response: {	"description": "TagList", "type": "object", {	"errno":{"type":"number"}, "channels": {		"type": "array", "channel": {			"type": "array", "items": {				"title": {"type": "string"}, "link": {"type": "string"}, "channel": {"type": "string"}, "description": {"type": "string"}, "pubDate": {"type": "string"}, "user": {"type": "string"}, "latitude" : {"type": "number"}, "longitude" : {"type": "number"}, "altitude":{"type":"number"} } 			}		}	} }

Get time slot of channel
Request should be http://tracks.osll.spb.ru:81/service/getTimeSlot {   "description": "Get time slot of channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "timeSlot": {"type":"number"} } }

In case of wrong auth_token or channel name:

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set time slot for channel
Request should be http://tracks.osll.spb.ru:81/service/setTimeSlot {   "description": "Set time slot for channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"}, "timeSlot": {"type":"number"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Get time slot of mark
Request should be http://tracks.osll.spb.ru:81/service/getTimeSlotMark {   "description": "Get time slot of mark", "type": "object", "properties": { "auth_token": {"type":"string"}, "mark_id":{"type":"number"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "timeSlot": {"type":"number"} } }

In case of wrong auth_token or id of mark:

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set time slot for mark
Request should be http://tracks.osll.spb.ru:81/service/setTimeSlotMark {   "description": "Set time slot for mark", "type": "object", "properties": { "auth_token": {"type":"string"}, "mark_id":{"type":"number"}, "timeSlot": {"type":"number"} } }


 * Response**

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set (Return to) default time slot for channel
Request for setting default time slot for channel (now default value is set to 1 year = 31536000000 ms). Request should be http://tracks.osll.spb.ru:81/service/setDefaultTimeSlot {   "description": "Set default time slot for channel", "type": "object", "properties": { "auth_token": {"type":"string"}, "channel":{"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set (Return to) default time slot for mark
Request for setting default time slot for mark (default time slot for mark is time slot of respective channel). Request should be http://tracks.osll.spb.ru:81/service/setDefaultTimeSlotMark {   "description": "Set default time slot for mark", "type": "object", "properties": { "auth_token": {"type":"string"}, "mark_id":{"type":"number"} } }

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set data for session
Request for setting data for session. Request should be http://tracks.osll.spb.ru:81/service/setSessionPoint {   "description": "Set data for session", "type": "object", "properties": { "auth_token": {"type":"string"}, "latitude": {"type":"number"}, "longitude": {"type":"number"}, "time":{"type":"string"}, "timeSlot":{"type":"number"}, "radius":{"type":"number"}, "isCurrentTime":{"type":"number"} } }

"isCurrentTime" = {0,1}. "1" means that user wants to use current time, "0" - some date-time in past or future.

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Get data of session
Request for getting data of session. Request should be http://tracks.osll.spb.ru:81/service/getSessionPoint {   "description": "Get data of session", "type": "object", "properties": { "auth_token": {"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "latitude": {"type":"number"}, "longitude": {"type":"number"}, "time":{"type":"string"}, "timeSlot":{"type":"number"}, "radius":{"type":"number"} } }

In case of wrong auth_token:

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"} } }

Set (return to) default data for session
Request for setting default data for session. Request should be http://tracks.osll.spb.ru:81/service/setDefaultSessionPoint {   "description": "Set default data for session", "type": "object", "properties": { "auth_token": {"type":"string"} } }

Response

{   "description": "response", "type": "object", "properties": { "status": {"type":"string"}, "status_description": {"type":"string"} } }

Return platform version
Request no request data needed. Just perform GET request to http://tracks.osll.spb.ru:81/service/version

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "version": {"type":"string"} } }

Return platform build(commit hash and number)
Request no request data needed. Just perform GET request to http://tracks.osll.spb.ru:81/service/build

Response

{   "description": "response", "type": "object", "properties": { "errno": {"type":"number"}, "version": {"type":"string"} } }

= How it can be tested =

You can write your own application or use curl for it. The way with curl described here

Overview results / questions