REST API and queries format

Log

  1. //service//log?number=10&offset=0&date_from=1983-01-22T08:00:00&date_to=2016-01-22T08:00:00
  2. method GET
  3. the query requires authorization
  4. input parameters:
    • number (type int, optional),
    • offset (type int, optional),
    • date_from (type date_utils.datetime_from_iso8601, optional),
    • date_to (type date_utils.datetime_from_iso8601, optional)
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "array",
  "items": {
    "id": "http://jsonschema.net/0",
    "type": "object",
    "properties": {
      "date": {
        "id": "http://jsonschema.net/0/date",
        "type": "object",
        "properties": {}
      },
      "message": {
        "id": "http://jsonschema.net/0/message",
        "type": "string"
      },
      "_id": {
        "id": "http://jsonschema.net/0/_id",
        "type": "object",
        "properties": {}
      },
      "user_id": {
        "id": "http://jsonschema.net/0/user_id",
        "type": "string"
      }
    },
    "required": [
      "date",
      "message",
      "_id",
      "user_id"
    ]
  },
  "required": [
    "0"
  ]
}

Channels

  1. //service//channel
  2. method POST
  3. the query requires authorization
  4. input parameters 
    • name (type unicode, mandatory),
    • json (type unicode, mandatory)
  5. output parameters:
id of created channel
  1. //service//channel?number=2&offset=0&substring=test
  2. method GET 
  3. the query requires authorization
  4. input parameters
    • substring (type unicode, optional),
    • number (type int,  optional),
    • offset (type int, optional)
  5.  output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "array",
  "items": [
    {
      "id": "http://jsonschema.net/0",
      "type": "object",
      "properties": {
        "json": {
          "id": "http://jsonschema.net/0/json",
          "type": "object",
          "properties": {
            "url": {
              "id": "http://jsonschema.net/0/json/url",
              "type": "string"
            },
            "description": {
              "id": "http://jsonschema.net/0/json/description",
              "type": "string"
            }
          },
          "required": [
            "url",
            "description"
          ]
        },
        "_id": {
          "id": "http://jsonschema.net/0/_id",
          "type": "object",
          "properties": {}
        },
        "name": {
          "id": "http://jsonschema.net/0/name",
          "type": "string"
        },
        "owner_id": {
          "id": "http://jsonschema.net/0/owner_id",
          "type": "string"
        }
      },
      "required": [
        "json",
        "_id",
        "name",
        "owner_id"
      ]
    },
    {
      "id": "http://jsonschema.net/1",
      "type": "object",
      "properties": {
        "json": {
          "id": "http://jsonschema.net/1/json",
          "type": "object",
          "properties": {}
        },
        "_id": {
          "id": "http://jsonschema.net/1/_id",
          "type": "object",
          "properties": {}
        },
        "name": {
          "id": "http://jsonschema.net/1/name",
          "type": "string"
        },
        "owner_id": {
          "id": "http://jsonschema.net/1/owner_id",
          "type": "string"
        }
      }
    }
  ],
  "required": [
    "0",
    "1"
  ]
}
  1.  //service//channel/CHANNEL_ID
  2. method PUT
  3. the query requires authorization
  4. input parameters
    • name (type unicode, mandatory),
    • json (type unicode, optional),
    • acl (type int, optional)
  5.  output parameters:
{}
  1.  //service//channel/CHANNEL_ID 2)
  2. method GET 
  3. the query requires authorization
  4. input parameters: CHANNEL_ID (type string, mandatory)
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "owner_group": {
      "id": "http://jsonschema.net/owner_group",
      "type": "string"
    },
    "name": {
      "id": "http://jsonschema.net/name",
      "type": "string"
    },
    "acl": {
      "id": "http://jsonschema.net/acl",
      "type": "integer"
    },
    "json": {
      "id": "http://jsonschema.net/json",
      "type": "string"
    },
    "_id": {
      "id": "http://jsonschema.net/_id",
      "type": "object",
      "properties": {}
    },
    "owner_id": {
      "id": "http://jsonschema.net/owner_id",
      "type": "string"
    }
  },
  "required": [
    "owner_group",
    "name",
    "acl",
    "json",
    "_id",
    "owner_id"
  ]
}
  1.  //service//channel/CHANNEL_ID
  2. method DELETE 
  3. the query requires authorization
  4. input parameters: CHANNEL_ID (type string, mandatory)
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}

Points

  1.  //service//point
  2. method POST 
  3. the query requires authorization
  4. input parameters
    • lon (type float, mandatory), 
    • lat (type float, mandatory),  
    • alt (type float, mandatory),
    • json (type словарь, mandatory),
    • channel_id (type unicode,  mandatory)
  5. output parameters:
[point_id]
  1. /<geo2tag_prefix>//service//point?channel_ids=556721a52a2e7febd2744201&number=10&altitude_from=0&altitude_%20to=5&offset=0&geometry=None&date_from=1970-09-10T01:01:01.000000&date_to=2100-09-10T01:01:01.000000&geometry={“type”: “Point”, “coordinates”: [1, 1]}
  2. method GET 
  3. the query requires authorization
  4. input parameters
    • channel_ids (type unicode, mandatory),
    • number (type int, mandatory),
    • geometry (type geo_json_type.GeoJsonType, optional),
    • altitude_from (type float, optional),
    • altitude_to (type float, optional),
    • date_from (type date_utils.datetime_from_iso8601, optional),
    • date_to (type date_utils.datetime_from_iso8601, optional),
    • offset (type int, optional),
    • radius (type float, optional)
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "array",
  "items": {
    "id": "http://jsonschema.net/0",
    "type": "object",
    "properties": {
      "channel_id": {
        "id": "http://jsonschema.net/0/channel_id",
        "type": "object",
        "properties": {}
      },
      "json": {
        "id": "http://jsonschema.net/0/json",
        "type": "object",
        "properties": {
          "image_url": {
            "id": "http://jsonschema.net/0/json/image_url",
            "type": "string"
          },
          "description": {
            "id": "http://jsonschema.net/0/json/description",
            "type": "string"
          }
        }
      },
      "location": {
        "id": "http://jsonschema.net/0/location",
        "type": "object",
        "properties": {
          "type": {
            "id": "http://jsonschema.net/0/location/type",
            "type": "string"
          },
          "coordinates": {
            "id": "http://jsonschema.net/0/location/coordinates",
            "type": "array",
            "items": [
              {
                "id": "http://jsonschema.net/0/location/coordinates/0",
                "type": "integer"
              },
              {
                "id": "http://jsonschema.net/0/location/coordinates/1",
                "type": "integer"
              }
            ]
          }
        }
      },
      "date": {
        "id": "http://jsonschema.net/0/date",
        "type": "object",
        "properties": {}
      },
      "alt": {
        "id": "http://jsonschema.net/0/alt",
        "type": "integer"
      },
      "_id": {
        "id": "http://jsonschema.net/0/_id",
        "type": "object",
        "properties": {}
      }
    },
    "required": [
      "channel_id",
      "json",
      "location",
      "date",
      "alt",
      "_id"
    ]
  },
  "required": [
    "0"
  ]
}
  1.  //service//point/POINT_ID
  2. method PUT 
  3. the query requires authorization
  4. input parameters
    • lon (type float, optional),
    • lat (type float, optional),
    • alt (type float, optional),
    • json (type unicode, optional),
    • channel_id (type unicode, optional)
  5.  output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}
  1. //service//point/POINT_ID
  2. method GET 
  3. the query requires authorization
  4.  input parameters: point_id
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "channel_id": {
      "id": "http://jsonschema.net/channel_id",
      "type": "null"
    },
    "json": {
      "id": "http://jsonschema.net/json",
      "type": "null"
    },
    "location": {
      "id": "http://jsonschema.net/location",
      "type": "object",
      "properties": {
        "type": {
          "id": "http://jsonschema.net/location/type",
          "type": "string"
        },
        "coordinates": {
          "id": "http://jsonschema.net/location/coordinates",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/location/coordinates/0",
              "type": "number"
            },
            {
              "id": "http://jsonschema.net/location/coordinates/1",
              "type": "number"
            }
          ]
        }
      }
    },
    "date": {
      "id": "http://jsonschema.net/date",
      "type": "object",
      "properties": {}
    },
    "alt": {
      "id": "http://jsonschema.net/alt",
      "type": "integer"
    },
    "_id": {
      "id": "http://jsonschema.net/_id",
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "channel_id",
    "json",
    "location",
    "date",
    "alt",
    "_id"
  ]
}
  1. //service//point/POINT_ID
  2. method DELETE 
  3. the query requires authorization
  4. input parameters: point_id
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}

Services

  1.  //service
  2. method POST
  3. the query requires authorization
  4. input parameters: 
    • name (type unicode, mandatory),
    • logSize (type int, optional),
    • ownerId (unicode, optional)
  5.  output parameters: 
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {},
  "required": [
    "$oid"
  ]
}
  1. //service?number=0&offset=0
  2. method GET
  3. the query requires authorization
  4. input parameters: 
    • number (type int, optional),
    • offset (type int, optional)
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "array",
  "items": [
    {
      "id": "http://jsonschema.net/0",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/0/_id",
          "type": "object",
          "properties": {}
        },
        "config": {
          "id": "http://jsonschema.net/0/config",
          "type": "object",
          "properties": {
            "log_size": {
              "id": "http://jsonschema.net/0/config/log_size",
              "type": "integer"
            }
          }
        },
        "name": {
          "id": "http://jsonschema.net/0/name",
          "type": "string"
        },
        "owner_id": {
          "id": "http://jsonschema.net/0/owner_id",
          "type": "string"
        }
      },
      "required": [
        "_id",
        "config",
        "name",
        "owner_id"
      ]
    },
    {
      "id": "http://jsonschema.net/1",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/1/_id",
          "type": "object",
          "properties": {}
        },
        "config": {
          "id": "http://jsonschema.net/1/config",
          "type": "object",
          "properties": {
            "log_size": {
              "id": "http://jsonschema.net/1/config/log_size",
              "type": "integer"
            },
            "logSize": {
              "id": "http://jsonschema.net/1/config/logSize",
              "type": "integer"
            }
          }
        },
        "name": {
          "id": "http://jsonschema.net/1/name",
          "type": "string"
        },
        "owner_id": {
          "id": "http://jsonschema.net/1/owner_id",
          "type": "string"
        }
      }
    }
  ],
  "required": [
    "0",
    "1"
  ]
}

 //service/SERVICE_NAME 

method PUT

the query requires authorization

input parameters:  logSize (type int, mandatory)

output parameters: 

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "SERVICE_NAME": {
      "id": "http://jsonschema.net/SERVICE_NAME",
      "type": "string"
    }
  },
  "required": [
    "SERVICE_NAME"
  ]
}
  1. //service/SERVICE_NAME
  2. method GET
  3. the query requires authorization
  4. input parameters: service_name
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "_id": {
      "id": "http://jsonschema.net/_id",
      "type": "object",
      "properties": {}
    },
    "config": {
      "id": "http://jsonschema.net/config",
      "type": "object",
      "properties": {
        "log_size": {
          "id": "http://jsonschema.net/config/log_size",
          "type": "integer"
        },
        "logSize": {
          "id": "http://jsonschema.net/config/logSize",
          "type": "integer"
        }
      }
    },
    "name": {
      "id": "http://jsonschema.net/name",
      "type": "string"
    },
    "owner_id": {
      "id": "http://jsonschema.net/owner_id",
      "type": "string"
    }
  },
  "required": [
    "_id",
    "config",
    "name",
    "owner_id"
  ]
}
  1. //service/SERVICE_NAME
  2. method DELETE 
  3. the query requires authorization
  4. input parameters: service_name
  5. output parameters:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {}
}

Plugins

  1. //plugin
  2. method GET 
  3. the query requires authorization
  4. input parameters: absent
  5. output parameters:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "test_plugin_for_fail": {
      "id": "http://jsonschema.net/test_plugin_for_fail",
      "type": "boolean"
    },
    "test_plugin_for_load_fail_gt_1435": {
      "id": "http://jsonschema.net/test_plugin_for_load_fail_gt_1435",
      "type": "boolean"
    },
    "test_plugin": {
      "id": "http://jsonschema.net/test_plugin",
      "type": "boolean"
    },
    "ok_import": {
      "id": "http://jsonschema.net/ok_import",
      "type": "boolean"
    },
    "testPlugin1": {
      "id": "http://jsonschema.net/testPlugin1",
      "type": "boolean"
    },
    "testPlugin2": {
      "id": "http://jsonschema.net/testPlugin2",
      "type": "boolean"
    }
  },
  "required": [
    "test_plugin_for_fail",
    "test_plugin_for_load_fail_gt_1435",
    "test_plugin",
    "ok_import",
    "testPlugin1",
    "testPlugin2"
  ]
}
  1.  //manage_plugins?PLUGIN_NAME=True
  2. method GET
  3. the query requires authorization
  4. input parameters: list of the plugins names specifying the status of each plugin (True/False)
  5. output parameters:
null

Logout

  1.  //logout
  2. method GET 
  3. the query requires authorization
  4. input parameters: absent
  5. output parameters
null
ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone