REST API и форматы запросов

ЛОГ

1)/<geo2tag_prefix>/service/<service_name>/log?number=10&offset=0&date_from=1983-01-22T08:00:00&date_to=2016-01-22T08:00:00

2) метод GET

3) запрос требует авторизации

4) входные параметры:

  • number (тип int, необязательный), 
  • offset (тип int, необязательный), 
  • date_from (тип date_utils.datetime_from_iso8601, необязательный), 
  • date_to (тип date_utils.datetime_from_iso8601, необязательный)

5) выходные параметры:

{
  "$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"
  ]
}

 


КАНАЛЫ 

1)/<geo2tag_prefix>/service/<service_name>/channel

2) метод POST

3)  запрос требует авторизации

4) входные параметры: 

  • name (тип unicode, обязательный), 
  • json (тип unicode, обязательный)

5) выходные параметры:

id созданного канала


1)/<geo2tag_prefix>/service/<service_name>/channel?number=2&offset=0&substring=test

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: 

  • substring (тип unicode, необязательный), 
  • number (тип int, необязательный), 
  • offset (тип int, необязательный)

5) выходные параметры:

 
{
  "$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) /<geo2tag_prefix>/service/<service_name>/channel/CHANNEL_ID

2) метод PUT 

3)  запрос требует авторизации

4) входные параметры: 

  • name (тип unicode, обязательный), 
  • json (тип unicode, необязательный),
  • acl (тип int, необязательный)

5) выходные параметры:

{}

1) /<geo2tag_prefix>/service/<service_name>/channel/CHANNEL_ID

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: 

  • CHANNEL_ID (тип string, обязательный)

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/service/<service_name>/channel/CHANNEL_ID

2) метод DELETE 

3)  запрос требует авторизации

4) входные параметры: 

  • CHANNEL_ID (тип string, обязательный)

5) выходные параметры:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}

 


ТОЧКИ 

1) /<geo2tag_prefix>/service/<service_name>/point

2) метод POST 

3)  запрос требует авторизации

4) входные параметры: 

  • lon (тип float, обязательный), 
  • lat (тип float, обязательный),  
  • alt (тип float, обязательный),
  • json (тип словарь, обязательный), 
  • channel_id (тип unicode, обязательный)

5) выходные параметры:

[point_id]

1) /<geo2tag_prefix>//service/<service_name>/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) метод GET 

3)  запрос требует авторизации

4) входные параметры: 

  • channel_ids (тип unicode, обязательный),
  • number (тип int, обязательный),
  • geometry (тип geo_json_type.GeoJsonType, необязательный), 
  • altitude_from (тип float, необязательный), 
  • altitude_to (тип float, необязательный), 
  • date_from (тип date_utils.datetime_from_iso8601, необязательный), 
  • date_to (тип date_utils.datetime_from_iso8601, необязательный), 
  • offset (тип int, необязательный),
  • radius (тип float, необязательный)

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/service/<service_name>/point/POINT_ID

2) метод PUT 

3)  запрос требует авторизации

4) входные параметры: 

  • lon (тип float, необязательный), 
  • lat (тип float, необязательный),  
  • alt (тип float, необязательный),
  • json (тип unicode, необязательный), 
  • channel_id (тип unicode, необязательный)

5) выходные параметры:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}


2) метод GET
 1) /<geo2tag_prefix>/service/<service_name>/point/POINT_ID

3)  запрос требует авторизации

4) входные параметры:

  • point_id

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/service/<service_name>/point/POINT_ID

2) метод DELETE 

3)  запрос требует авторизации

4) входные параметры:

  • point_id

5) выходные параметры:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {}
}


 


СЕРВИСЫ 

1) /<geo2tag_prefix>/service

2) метод POST 

3)  запрос требует авторизации

4) входные параметры: 

  • name (тип unicode, обязательный), 
  • logSize (тип int, необязательный), 
  • ownerId (unicode, необязательный)

5) выходные параметры:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {},
  "required": [
    "$oid"
  ]
}


1) /<geo2tag_prefix>/service?number=0&offset=0

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: 

  • number (тип int, необязательный), 
  • offset (тип int, необязательный)

5) выходные параметры:

{
  "$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"
  ]
}


1) /<geo2tag_prefix>/service/SERVICE_NAME

2) метод PUT 

3)  запрос требует авторизации

4) входные параметры: 

  • logSize (тип int, обязательный)

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/service/SERVICE_NAME

2) метод GET 

3)  запрос требует авторизации

4) входные параметры:

  • service_name

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/service/SERVICE_NAME

2) метод DELETE 

3)  запрос требует авторизации

4) входные параметры:

  • service_name

5) выходные параметры:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {}
}

 


ПЛАГИНЫ

1) /<geo2tag_prefix>/plugin

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: отсутствуют

5) выходные параметры:

{
  "$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) /<geo2tag_prefix>/manage_plugins?PLUGIN_NAME=True

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: 

  • список имен плагинов с указанием состояния каждого (True/False)

5) выходные параметры:

null

 


LOGOUT

1) /<geo2tag_prefix>/logout

2) метод GET 

3)  запрос требует авторизации

4) входные параметры: отсутствуют

5) выходные параметры: 

null