Add stuff to api

getLog finished
This commit is contained in:
John 2015-09-22 02:04:11 +02:00
commit f7bffdc050
3 changed files with 471 additions and 142 deletions

57
API.md
View file

@ -4,24 +4,77 @@ The API is still pretty new and needs some serious cleaning up on the backend bu
## General structure
The API endpoint is `http://ip:port + HTTP_ROOT + /api?apikey=$apikey&cmd=$command`
Data response in JSON formatted.
Response example
```
{
"response": {
"data": [
{
"loglevel": "INFO",
"msg": "Signal 2 caught, saving and exiting...",
"thread": "MainThread",
"time": "22-sep-2015 01:42:56 "
}
],
"message": null,
"result": "success"
}
}
```
General parameters:
out_type: 'xml',
callback: 'pong',
'debug': 1
## API methods
### getLogs
Not working yet
Possible params: sort='', search='', order='desc', regex='', start=0, end=0
Returns the plexpy log
### getApikey
Possible params: username='', password='' (required if auth is enabled)
Returns the apikey
### getSettings
No params
Returns the config file
### getVersion
No params
Returns some version information: git_path, install_type, current_version, installed_version, commits_behind
### getHistory
possible params: user=None, user_id=None, ,rating_key='', parent_rating_key='', grandparent_rating_key='', start_date=''
Returns
### getMetadata
Required params: rating_key
Returns metadata about a file
### getSync
Possible params: machine_id=None, user_id=None,
Returns
### getUserips
Possible params: user_id=None, user=None
### getPlayby
Possible params: time_range=30, y_axis='plays', playtype='total_plays_per_month'
### checkGithub
Updates the version information above and returns getVersion data
### shutdown
No params
Shut down plexpy
### restart
No params
Restart plexpy
### update
No params
Update plexpy - you may want to check the install type in get version and not allow this if type==exe