|
|
|
@ -30,7 +30,7 @@ class Watch(Resource):
|
|
|
|
|
self.update_q = kwargs['update_q']
|
|
|
|
|
|
|
|
|
|
# Get information about a single watch, excluding the history list (can be large)
|
|
|
|
|
# curl http://localhost:4000/api/v1/watch/<string:uuid>
|
|
|
|
|
# curl http://localhost:5000/api/v1/watch/<string:uuid>
|
|
|
|
|
# @todo - version2 - ?muted and ?paused should be able to be called together, return the watch struct not "OK"
|
|
|
|
|
# ?recheck=true
|
|
|
|
|
@auth.check_token
|
|
|
|
@ -39,9 +39,9 @@ class Watch(Resource):
|
|
|
|
|
@api {get} /api/v1/watch/:uuid Single watch - get data, recheck, pause, mute.
|
|
|
|
|
@apiDescription Retrieve watch information and set muted/paused status
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl "http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091?muted=unmuted" -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl "http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091?paused=unpaused" -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl "http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091?muted=unmuted" -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl "http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091?paused=unpaused" -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
@apiName Watch
|
|
|
|
|
@apiGroup Watch
|
|
|
|
|
@apiParam {uuid} uuid Watch unique ID.
|
|
|
|
@ -84,7 +84,7 @@ class Watch(Resource):
|
|
|
|
|
"""
|
|
|
|
|
@api {delete} /api/v1/watch/:uuid Delete a watch and related history
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
@apiParam {uuid} uuid Watch unique ID.
|
|
|
|
|
@apiName Delete
|
|
|
|
|
@apiGroup Watch
|
|
|
|
@ -103,7 +103,7 @@ class Watch(Resource):
|
|
|
|
|
@api {put} /api/v1/watch/:uuid Update watch information
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
Update (PUT)
|
|
|
|
|
curl http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"url": "https://my-nice.com" , "tag": "new list"}'
|
|
|
|
|
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"url": "https://my-nice.com" , "tag": "new list"}'
|
|
|
|
|
|
|
|
|
|
@apiDescription Updates an existing watch using JSON, accepts the same structure as returned in <a href="#api-Watch-Watch">get single watch information</a>
|
|
|
|
|
@apiParam {uuid} uuid Watch unique ID.
|
|
|
|
@ -132,13 +132,13 @@ class WatchHistory(Resource):
|
|
|
|
|
self.datastore = kwargs['datastore']
|
|
|
|
|
|
|
|
|
|
# Get a list of available history for a watch by UUID
|
|
|
|
|
# curl http://localhost:4000/api/v1/watch/<string:uuid>/history
|
|
|
|
|
# curl http://localhost:5000/api/v1/watch/<string:uuid>/history
|
|
|
|
|
def get(self, uuid):
|
|
|
|
|
"""
|
|
|
|
|
@api {get} /api/v1/watch/<string:uuid>/history Get a list of all historical snapshots available for a watch
|
|
|
|
|
@apiDescription Requires `uuid`, returns list
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json"
|
|
|
|
|
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json"
|
|
|
|
|
{
|
|
|
|
|
"1676649279": "/tmp/data/6a4b7d5c-fee4-4616-9f43-4ac97046b595/cb7e9be8258368262246910e6a2a4c30.txt",
|
|
|
|
|
"1677092785": "/tmp/data/6a4b7d5c-fee4-4616-9f43-4ac97046b595/e20db368d6fc633e34f559ff67bb4044.txt",
|
|
|
|
@ -166,7 +166,7 @@ class WatchSingleHistory(Resource):
|
|
|
|
|
@api {get} /api/v1/watch/<string:uuid>/history/<int:timestamp> Get single snapshot from watch
|
|
|
|
|
@apiDescription Requires watch `uuid` and `timestamp`. `timestamp` of "`latest`" for latest available snapshot, or <a href="#api-Watch_History-Get_list_of_available_stored_snapshots_for_watch">use the list returned here</a>
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history/1677092977 -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json"
|
|
|
|
|
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history/1677092977 -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json"
|
|
|
|
|
@apiName Get single snapshot content
|
|
|
|
|
@apiGroup Watch History
|
|
|
|
|
@apiSuccess (200) {String} OK
|
|
|
|
@ -202,7 +202,7 @@ class CreateWatch(Resource):
|
|
|
|
|
@api {post} /api/v1/watch Create a single watch
|
|
|
|
|
@apiDescription Requires atleast `url` set, can accept the same structure as <a href="#api-Watch-Watch">get single watch information</a> to create.
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"url": "https://my-nice.com" , "tag": "nice list"}'
|
|
|
|
|
curl http://localhost:5000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"url": "https://my-nice.com" , "tag": "nice list"}'
|
|
|
|
|
@apiName Create
|
|
|
|
|
@apiGroup Watch
|
|
|
|
|
@apiSuccess (200) {String} OK Was created
|
|
|
|
@ -245,7 +245,7 @@ class CreateWatch(Resource):
|
|
|
|
|
@api {get} /api/v1/watch List watches
|
|
|
|
|
@apiDescription Return concise list of available watches and some very basic info
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl http://localhost:5000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
{
|
|
|
|
|
"6a4b7d5c-fee4-4616-9f43-4ac97046b595": {
|
|
|
|
|
"last_changed": 1677103794,
|
|
|
|
@ -363,7 +363,7 @@ class SystemInfo(Resource):
|
|
|
|
|
@api {get} /api/v1/systeminfo Return system info
|
|
|
|
|
@apiDescription Return some info about the current system state
|
|
|
|
|
@apiExample {curl} Example usage:
|
|
|
|
|
curl http://localhost:4000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
curl http://localhost:5000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
|
|
|
|
|
HTTP/1.0 200
|
|
|
|
|
{
|
|
|
|
|
'queue_size': 10 ,
|
|
|
|
|