OnSong® Connect API

Media

Media are images and videos that can be used as background for lyrics projection.

List media

URL/api/<auth_token>/media
MethodGET
Version1.0

Description

Retrieves a list of media items on the device.

Path arguments

Name Type Description Required
auth_token string The authentication token used to authenticate the request. Required

Query arguments

Name Type Description Required
types string A comma-delimited list of types. Types can be video, image or audio. Optional

Response

Returns the results as an array of media items.

{
	"results": [
		{
			"ID": "12bdd5a5e8b85b1505782e38e7b4288d351d0d7b",
			"title": "Blue Bokeh",
			"type": "video",
			"notes": {
				"width": 1920,
				"duration": 16.55820846557617,
				"height": 1080
			},
			"fileSize": 2321914
		},
		{
			"ID": "FE4B1B7C-01BC-40CE-BCA0-299CC9542090",
			"type": "image",
			"fileSize": 3030120,
			"notes": {
				"width": 1707,
				"height": 1280
			}
		}
	],
	"count": 3,
	"types": null
}

Media information

URL/api/<auth_token>/media/<media_id>
MethodGET
Version1.0

Description

Retrieves a list of media items on the device.

Path arguments

Name Type Description Required
auth_token string The authentication token used to authenticate the request. Required
media_id string The identifier of the media to return. If set to "current", the currently selected media item for lyrics projection is returned. Required

Response

Returns the media item.

{
	"ID": "12bdd5a5e8b85b1505782e38e7b4288d351d0d7b",
	"title": "Blue Bokeh",
	"type": "video",
	"notes": {
		"width": 1920,
		"duration": 16.55820846557617,
		"height": 1080
	},
	"fileSize": 2321914
}

Download media content

URL/api/<auth_token>/media/<media_id>/content
MethodGET
Version1.0

Description

Retrieves the asset represented by the media item. This will download the video, image or audio file.

Path arguments

Name Type Description Required
auth_token string The authentication token used to authenticate the request. Required
media_id string The identifier of the media to return. If set to "current", the currently selected media item for lyrics projection is returned. Required

Response

A successful response is the media item's asset content such as a video, image or audio file. The MIME type of the response is set the MIME type of the underlying asset that was returned. In the event of a failure, a 404 status code is returned with an error property.

{
	"error": "Media not found"
}

Import media

URL/api/<auth_token>/media
MethodPOST
Version1.0

Description

Uploads media assets into the user's media library and returns an array containing the newly created media items.

Path arguments

Name Type Description Required
auth_token string The authentication token used to authenticate the request. Required

Body

Upload one or more files using one or more files in a multipart form data. In HTML you can do this with the following code:

<form action="/api/<auth_token>/media/import" method="post" enctype="multipart/form-data">
	<input type="file" name="file1"/>
	<input type="file" name="file2"/>
	<input type="submit" value="Import"/>
</form>

Response

Returns the number of files that were imported with a success boolean, or an error property with a message..

Response example

{
    "count": 2,
    "success": true
}