diff --git a/README_JSON_API.md b/README_JSON_API.md index 8d5b155f..b9d36fba 100644 --- a/README_JSON_API.md +++ b/README_JSON_API.md @@ -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 diff --git a/htdocs/admin/js/forked-daapd.js b/htdocs/admin/js/forked-daapd.js index d0f072db..0404f75f 100644 --- a/htdocs/admin/js/forked-daapd.js +++ b/htdocs/admin/js/forked-daapd.js @@ -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() { diff --git a/src/httpd_jsonapi.c b/src/httpd_jsonapi.c index 30e821a1..820c6697 100644 --- a/src/httpd_jsonapi.c +++ b/src/httpd_jsonapi.c @@ -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 }, diff --git a/web-src/src/webapi/index.js b/web-src/src/webapi/index.js index dc753b9e..9f708738 100644 --- a/web-src/src/webapi/index.js +++ b/web-src/src/webapi/index.js @@ -18,7 +18,7 @@ export default { }, library_update () { - return axios.get('/api/update') + return axios.put('/api/update') }, library_update_meta () {