mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
[jsonapi] Return number of items added in queue/items/add endpoint
response
This commit is contained in:
parent
2b7ff60771
commit
dcbe503686
@ -587,7 +587,12 @@ POST /api/queue/items/add
|
|||||||
|
|
||||||
**Response**
|
**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**
|
**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"
|
curl -X POST "http://localhost:3689/api/queue/items/add?uris=library:playlist:68,library:artist:2932599850102967727"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"count": 42
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Moving a queue item
|
### Moving a queue item
|
||||||
|
|
||||||
|
@ -1745,6 +1745,7 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq)
|
|||||||
const char *id;
|
const char *id;
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
json_object *reply;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
||||||
@ -1814,10 +1815,19 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq)
|
|||||||
|
|
||||||
free(uris);
|
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)
|
if (ret < 0)
|
||||||
return HTTP_INTERNAL;
|
return HTTP_INTERNAL;
|
||||||
|
|
||||||
return HTTP_NOCONTENT;
|
return HTTP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user