[web-src/jsonapi] move endpoint /api/update as PUT operation

This commit is contained in:
whatdoineed2do/Ray 2019-06-18 10:15:22 +01:00 committed by ejurgensen
parent 8c024387ae
commit e0a18082f7
4 changed files with 7 additions and 6 deletions

View File

@ -722,7 +722,7 @@ curl -X PUT "http://localhost:3689/api/queue/items/2"
| GET | [/api/library/genres](#list-genres) | Get list of genres |
| GET | [/api/library/count](#get-count-of-tracks-artists-and-albums) | Get count of tracks, artists and albums |
| GET | [/api/library/files](#list-local-directories) | Get list of directories in the local library |
| GET | [/api/update](#trigger-rescan) | Trigger a library rescan |
| PUT | [/api/update](#trigger-rescan) | Trigger a library rescan |
| PUT | [/api/rescan](#trigger-meta-rescan) | Trigger a library metadata rescan |
@ -1633,7 +1633,7 @@ Trigger a library rescan
**Endpoint**
```http
GET /api/update
PUT /api/update
```
**Response**
@ -1643,7 +1643,7 @@ On success returns the HTTP `204 No Content` success status response code.
**Example**
```shell
curl -X GET "http://localhost:3689/api/update"
curl -X PUT "http://localhost:3689/api/update"
```
```json

View File

@ -53,7 +53,7 @@ var app = new Vue({
update: function() {
this.library.updating = true;
axios.get('/api/update').then(console.log('Library is updating'));
axios.put('/api/update').then(console.log('Library is updating'));
},
update_meta: function() {

View File

@ -3517,7 +3517,8 @@ static struct httpd_uri_map adm_handlers[] =
{
{ EVHTTP_REQ_GET, "^/api/config$", jsonapi_reply_config },
{ EVHTTP_REQ_GET, "^/api/library$", jsonapi_reply_library },
{ EVHTTP_REQ_GET, "^/api/update$", jsonapi_reply_update },
{ EVHTTP_REQ_GET |
EVHTTP_REQ_PUT, "^/api/update$", jsonapi_reply_update },
{ EVHTTP_REQ_PUT, "^/api/rescan$", jsonapi_reply_meta_rescan },
{ EVHTTP_REQ_POST, "^/api/spotify-login$", jsonapi_reply_spotify_login },
{ EVHTTP_REQ_GET, "^/api/spotify$", jsonapi_reply_spotify },

View File

@ -18,7 +18,7 @@ export default {
},
library_update () {
return axios.get('/api/update')
return axios.put('/api/update')
},
library_update_meta () {