-
Notifications
You must be signed in to change notification settings - Fork 35
Add collections #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add collections #237
Changes from all commits
d3cd5f3
d9a6e1e
39e1276
df8066d
6593dac
97ec0b4
1ff6339
7848329
4543fff
dfe1f39
edd6e21
cdbeedc
25f1d9d
af0d888
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| --- | ||
| title: "createCollection" | ||
| linkTitle: "createCollection [OS]" | ||
| categories: | ||
| - Collections | ||
| opensubsonic: | ||
| - Extension | ||
| description: > | ||
| Creates a collection. | ||
| --- | ||
|
|
||
| `http://your-server/rest/createCollection` | ||
|
|
||
| Creates a collection. | ||
| This endpoint must be accessed using an HTTP POST request. | ||
|
|
||
| ### Request Body | ||
|
|
||
| The request payload should be provided in the body as a JSON object, as specified by the [CreateCollectionRequest](../payloads/createcollectionrequest) schema. | ||
|
|
||
| {{< tabpane persist=false >}} | ||
| {{< tab header="CreateCollectionRequest" lang="json">}} | ||
| { | ||
| "name": "test collection", | ||
| "comment": "this is a collection", | ||
| "items": [ | ||
| { | ||
| "type": "song", | ||
| "id": "300000060" | ||
| }, | ||
| { | ||
| "type": "album", | ||
| "id": "200000021" | ||
| }, | ||
| { | ||
| "type": "genre", | ||
| "id": "vaporwave" | ||
| } | ||
| ] | ||
| } | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| ### Example request | ||
|
|
||
| {{< alert color="primary" >}} `POST http://your-server/rest/createCollection.view?u=demo&p=demo&v=1.16.1&c=AwesomeClientName&f=json` {{< /alert >}} | ||
|
|
||
| ### Result | ||
|
|
||
| A [`subsonic-response`](../../responses/subsonic-response) element with a top-level [`collection`](../../responses/collection) object on success. | ||
| In case of an error, a standard HTTP error code is returned with a descriptive message. | ||
|
|
||
| {{< tabpane persist=false >}} | ||
|
ygabuev marked this conversation as resolved.
|
||
| {{< tab header="**Example**:" disabled=true />}} | ||
| {{< tab header="OpenSubsonic" lang="json">}} | ||
| { | ||
| "subsonic-response": { | ||
| "status": "ok", | ||
| "version": "1.16.1", | ||
| "type": "AwesomeServerName", | ||
| "serverVersion": "0.1.3 (tag)", | ||
| "openSubsonic": true, | ||
| "collection": { | ||
| "id": "800000075", | ||
| "name": "test collection", | ||
| "comment" "this is a collection", | ||
| "owner": "user", | ||
| "public": false, | ||
| "itemCount": 3, | ||
| "created": "2023-03-16T03:18:41+00:00", | ||
| "changed": "2023-03-16T03:18:41+00:00" | ||
| } | ||
| } | ||
| } | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| | Field | Type | Req. | OpenS. | Details | | ||
| | --- | --- | --- | --- | --- | | ||
| | `collection` | [`Collection`](../../responses/collection) | **Yes** | | The collection | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| title: "deleteCollection" | ||
| linkTitle: "deleteCollection [OS]" | ||
| opensubsonic: | ||
| - Extension | ||
| categories: | ||
| - Collections | ||
| description: > | ||
| Deletes a collection. | ||
| --- | ||
| `http://your-server/rest/deleteCollection` | ||
|
|
||
| Deletes a collection. | ||
|
|
||
| ### Parameters | ||
|
|
||
| | Parameter | Req. | OpenS. | Default | Comment | | ||
| | --- | --- | --- | --- | --- | | ||
| | `id` | **Yes** | | | ID of the collection to delete, as obtained by `getCollections`. | | ||
|
|
||
| ### Example | ||
|
|
||
| {{< alert color="primary" >}} `http://your-server/rest/deleteCollection.view?id=123&u=demo&p=demo&v=1.13.0&c=AwesomeClientName&f=json` {{< /alert >}} | ||
|
|
||
| ### Result | ||
|
|
||
| An empty [`subsonic-response`](../../responses/subsonic-response) element on success. | ||
|
|
||
| {{< tabpane persist=false >}} | ||
| {{< tab header="**Example**:" disabled=true />}} | ||
| {{< tab header="OpenSubsonic" lang="json">}} | ||
| { | ||
| "subsonic-response": { | ||
| "status": "ok", | ||
| "version": "1.16.1", | ||
| "type": "AwesomeServerName", | ||
| "serverVersion": "0.1.3 (tag)", | ||
| "openSubsonic": true | ||
| } | ||
| } | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| --- | ||
| title: "getCollection" | ||
| linkTitle: "getCollection [OS]" | ||
| categories: | ||
| - Collections | ||
| OpenSubsonic: | ||
| - Extension | ||
| description: > | ||
| Returns a collection. | ||
| --- | ||
|
|
||
| `http://your-server/rest/getCollection` | ||
|
|
||
| Returns a collection with the items it contains. | ||
|
|
||
| ### Parameters | ||
|
|
||
| | Parameter | Req. | OpenS. | Default | Comment | | ||
| | --- | --- | --- | --- | --- | | ||
| | `id` | **Yes** | | | ID of the collection to return, as obtained by `getCollections`. | | ||
| | `itemCount` | No | | | The number of items from the collection to return. If unset or set to a negative value, return all items. | | ||
| | `itemOffset` | No | | | The number of items to skip. | | ||
|
ygabuev marked this conversation as resolved.
|
||
|
|
||
| ### Example | ||
|
|
||
| {{< alert color="primary" >}} `http://your-server/rest/getCollection.view?id=123&u=demo&p=demo&v=1.13.0&c=AwesomeClientName&f=json` {{< /alert >}} | ||
|
|
||
| ### Result | ||
|
|
||
| A [`subsonic-response`](../../responses/subsonic-response) element with a top-level `collection` object of type [collectionWithItems](../../responses/collectionwithitems) | ||
|
|
||
| {{< tabpane persist=false >}} | ||
| {{< tab header="**Example**:" disabled=true />}} | ||
| {{< tab header="OpenSubsonic" lang="json">}} | ||
| { | ||
| "subsonic-response": { | ||
| "status": "ok", | ||
| "version": "1.16.1", | ||
| "type": "AwesomeServerName", | ||
| "serverVersion": "0.1.3 (tag)", | ||
| "openSubsonic": true, | ||
| "collection": { | ||
| "id": "800000075", | ||
| "name": "testcreate", | ||
| "comment" "this is a collection", | ||
| "owner": "user", | ||
| "public": true, | ||
| "itemCount": 3, | ||
| "created": "2023-03-16T03:18:41+00:00", | ||
| "changed": "2023-03-16T03:18:41+00:00", | ||
| "items": [ | ||
| { | ||
| "song": { | ||
| "id": "300000060", | ||
| "parent": "200000002", | ||
| "title": "BrownSmoke", | ||
| "isDir": false, | ||
| "isVideo": false, | ||
| "type": "music", | ||
| "albumId": "200000002", | ||
| "album": "Colorsmoke EP", | ||
| "artistId": "100000002", | ||
| "artist": "Synthetic", | ||
| "coverArt": "300000060", | ||
| "duration": 304, | ||
| "bitRate": 20, | ||
| "bitDepth": 16, | ||
| "samplingRate": 44100, | ||
| "channelCount": 2, | ||
| "userRating": 5, | ||
| "averageRating": 5, | ||
| "track": 4, | ||
| "year": 2007, | ||
| "genre": "Electronic", | ||
| "size": 792375, | ||
| "discNumber": 1, | ||
| "suffix": "wma", | ||
| "contentType": "audio/x-ms-wma", | ||
| "path": "Synthetic/Synthetic_-_Colorsmoke_EP-20k217-2007/04-Synthetic_-_BrownSmokeYSBM20k22khS.wma" | ||
| } | ||
| }, | ||
| { | ||
| "album": { | ||
| "id": "200000021", | ||
| "parent": "100000036", | ||
| "album": "Forget and Remember", | ||
| "title": "Forget and Remember", | ||
| "name": "Forget and Remember", | ||
| "isDir": true, | ||
| "coverArt": "al-200000021", | ||
| "songCount": 20, | ||
| "created": "2021-07-22T02:09:31+00:00", | ||
| "duration": 4248, | ||
| "playCount": 0, | ||
| "artistId": "100000036", | ||
| "artist": "Comfort Fit", | ||
| "year": 2005, | ||
| "genre": "Hip-Hop" | ||
| } | ||
| }, | ||
| { | ||
| "genre": { | ||
| "value": "vaporwave", | ||
| "songCount": 6, | ||
| "albumCount": 1 | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| | Field | Type | Req. | OpenS. | Details | | ||
| | --- | --- | --- | --- | --- | | ||
| | `collection` | [`collectionWithItems`](../../responses/collectionwithitems) | **Yes** | | The collection | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| --- | ||
| title: "getCollections" | ||
| linkTitle: "getCollections [OS]" | ||
| OpenSubsonic: | ||
| - Extension | ||
| categories: | ||
| - Collections | ||
| description: > | ||
| Returns collections a user has access to. | ||
| --- | ||
|
|
||
| `http://your-server/rest/getCollections` | ||
|
|
||
| Returns collections a user has access to, with optional filters and pagination. | ||
|
|
||
| ### Parameters | ||
|
|
||
| | Parameter | Req. | OpenS. | Default | Comment | | ||
| | --- | --- | --- | --- | --- | | ||
| | `username` | No | | | If specified, return collections for this user rather than for the authenticated user. The authenticated user must have admin role if this parameter is used. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any plans to add pagination, filters, and/or search? If a user makes a large number of collections, it could be messy with no pagination options.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the pagination, but not sure about filtering and search at this point. Looks like the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't talk about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Welp 🤷 Then what is the current state of search in the community?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's to be defined, but it's per endpoint with filtering and ordering as kgarner said we also need to define field selections.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a simple filter by name and sorting. |
||
| | `name` | No | | | If specified, return collections that have the provided string in their name. | | ||
| | `sort` | No | | name | If specified, sort the list by the provided field or randomly. Sorting is applied before the `count` and `offset` parameters are taken into account. The default is to sort by name. Allowed values: name, created, random. | | ||
| | `order` | No | | asc | The order of sorting. Allowed values: asc, desc. | | ||
| | `count` | No | | | The number of collections to return. If unset or set to a negative value, return all collections. | | ||
| | `offset` | No | | | The number of collections to skip. | | ||
|
|
||
| ### Example | ||
|
|
||
| {{< alert color="primary" >}} `http://your-server/rest/getCollections.view?count=2&u=demo&p=demo&v=1.13.0&c=AwesomeClientName&f=json` {{< /alert >}} | ||
|
|
||
| ### Result | ||
|
|
||
| A [`subsonic-response`](../../responses/subsonic-response) element with a top-level `collections` array of [collection](../../responses/collection) elements on success. | ||
|
|
||
| {{< tabpane persist=false >}} | ||
| {{< tab header="**Example**:" disabled=true />}} | ||
| {{< tab header="OpenSubsonic" lang="json">}} | ||
| { | ||
| "subsonic-response": { | ||
| "status": "ok", | ||
| "version": "1.16.1", | ||
| "type": "AwesomeServerName", | ||
| "serverVersion": "0.1.3 (tag)", | ||
| "openSubsonic": true, | ||
| "collections": [ | ||
| { | ||
| "id": "800000075", | ||
| "name": "testcollection", | ||
| "owner": "user", | ||
| "public": true, | ||
| "created": "2026-03-16T03:18:41+00:00", | ||
| "changed": "2026-03-16T03:18:41+00:00", | ||
| "itemCount": 3, | ||
| "readonly": true | ||
| }, | ||
| { | ||
| "id": "800000076", | ||
| "name": "testcollection2", | ||
| "comment" "this is another collection", | ||
| "owner": "user", | ||
| "public": false, | ||
| "itemCount": 17, | ||
| "created": "2026-03-16T03:18:41+00:00", | ||
| "changed": "2026-03-16T03:18:41+00:00", | ||
| "readonly": true | ||
| } | ||
| ], | ||
| "totalCount": 10 | ||
| } | ||
| } | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| | Field | Type | Req. | OpenS. | Details | | ||
| | --- | --- | --- | --- | --- | | ||
| | `collections` | Array of [`collection`](../../responses/collection) | **Yes** | | The collections. | | ||
| | `totalCount` | integer | **Yes** | | The total number of collections a user has access to. | | ||
Uh oh!
There was an error while loading. Please reload this page.