diff --git a/README_JSON_API.md b/README_JSON_API.md index fd24e847..6a62cf88 100644 --- a/README_JSON_API.md +++ b/README_JSON_API.md @@ -587,7 +587,12 @@ POST /api/queue/items/add **Response** -On success returns the HTTP `204 No Content` success status response code. +On success returns the HTTP `200 OK` success status response code. + +| Key | Type | Value | +| --------------- | -------- | ----------------------------------------- | +| count | integer | number of tracks added to the queue | + **Example** @@ -595,6 +600,12 @@ On success returns the HTTP `204 No Content` success status response code. curl -X POST "http://localhost:3689/api/queue/items/add?uris=library:playlist:68,library:artist:2932599850102967727" ``` +```json +{ + "count": 42 +} +``` + ### Moving a queue item diff --git a/src/httpd_jsonapi.c b/src/httpd_jsonapi.c index 43447571..71260f84 100644 --- a/src/httpd_jsonapi.c +++ b/src/httpd_jsonapi.c @@ -1745,6 +1745,7 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq) const char *id; int pos = -1; int count = 0; + json_object *reply; int ret = 0; @@ -1814,10 +1815,19 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq) free(uris); + if (ret == 0) + { + reply = json_object_new_object(); + json_object_object_add(reply, "count", json_object_new_int(count)); + + ret = evbuffer_add_printf(hreq->reply, "%s", json_object_to_json_string(reply)); + jparse_free(reply); + } + if (ret < 0) return HTTP_INTERNAL; - return HTTP_NOCONTENT; + return HTTP_OK; } static int