Prepr Documentation

Prepr Documentation

Welcome to the Prepr Documentation. You'll find comprehensive guides and documentation to help you start working with Prepr as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Now Playing

Prepr offers a feature to request or receive the latest played Track. A played track is in Prepr the TrackPlay publication model. The latest played track can be requested by an API endpoint or on a webhook.

Webhook

The most common way to follow the Now Playing information is to subscribe a webhook to the publication.published event. This event will be triggered whenever a TrackPlay is published.

{
	"id": "99bdd3-c1ad-490e-87db-43b60a8961",
	"created_on": 1530617354,
	"event": "publication.published",
	"payload": {
		"id": "f91370-2069-4d12-afcc-ccc9265e59bd",
		"created_on": "2018-07-02T23:01:53+00:00",
		"changed_on": "2018-07-03T11:29:13+00:00",
		"published_on": "2018-07-03T11:27:40+00:00",
		"unpublish_on": null,
		"label": "TrackPlay",
		"status": "published",
		"slug": null,
		"custom": null,
		"artist": "Erma Franklin",
		"reference_id": "0088346",
		"note": "",
		"artist_text": "Erma Franklin",
		"body": "Piece Of My Heart",
    "duration": "2136981673"
	}
}

Checkout the Webhooks docs for more information on how to subscribe to Events.

Endpoint

To get the latest played tracks do a GET request on the /publications endpoint. You should include the following parameters:

label = TrackPlay, status = published, order_by = -published_on, limit = 1

{
    "items": [
        {
            "id": "f91370-2069-4d12-afcc-ccc9265e59bd",
            "created_on": "2018-07-02T23:01:53+00:00",
            "changed_on": "2018-07-03T11:29:13+00:00",
            "published_on": "2018-07-03T11:27:40+00:00",
            "unpublish_on": null,
            "label": "TrackPlay",
            "status": "published",
            "slug": null,
            "artist": "Erma Franklin",
            "reference_id": "0088346",
            "note": "",
            "artist_text": "Erma Franklin",
            "body": "Piece Of My Heart",
            "duration": "2136981673"
        }
    ],
    "total": 1560,
    "after": "YWZ0ZXJfMQ==",
    "before": "YmVmb3JlXzA=",
    "skip": 0,
    "limit": 1
}