[jsonapi] Return number of items added in queue/items/add endpoint

response
This commit is contained in:
chme 2018-12-17 19:03:34 +01:00
parent 2b7ff60771
commit dcbe503686
2 changed files with 23 additions and 2 deletions

View File

@ -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

View File

@ -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