-
Notifications
You must be signed in to change notification settings - Fork 1
#Devices
Example request:
POST /devices
{
"streamUrl":"http://192.168.0.1",
"lastConnected":1384005056,
"owner":{"id" : 0}
}
Response:
201
get a device. Example Request:
GET /devices?filter=uuid=d72e2f37-04a8-46b2-a3b8-4d633938e47b
Response:
[ {
"id" : 0,
"creationTime" : "2013-11-09T14:38:07.368Z",
"uuid" : "d72e2f37-04a8-46b2-a3b8-4d633938e47b",
"streamUrl" : "http://192.168.0.12",
"lastConnected" : 1384005050,
"owner" : {
"id" : 0,
"creationTime" : "2013-11-09T14:37:56.706Z",
"email" : "test@test.com",
"payoutAddress" : "1cenaou"
}
} ]
Example Request:
PUT /devices/d72e2f37-04a8-46b2-a3b8-4d633938e47b
{
"streamUrl":"http://192.168.0.12",
"lastConnected":1384005050
}
Response:
204
Example request:
POST /playlists/3aeded65-7b26-4805-b088-1df76ee28de2
{
"name":"spike",
"active":true
}
Response:
201
If a playlist with this name exists, a 409 will be returned.
Activate or disable a playlist. Example request:
PUT /playlists/3aeded65-7b26-4805-b088-1df76ee28de2
{
"name":"spike",
"active":false
}
Response:
204
If the object doesn't exist already a 404 will be returned.
Example request:
GET /playlists/3aeded65-7b26-4805-b088-1df76ee28de2?active=true
Response:
[ {
"id" : 1,
"creationTime" : "2013-11-09T16:22:25.149Z",
"name" : "spike",
"active" : true
}, {
"id" : 0,
"creationTime" : "2013-11-09T16:03:28.225Z",
"name" : "jackson",
"active" : true
} ]
If the collection is empty [] is returned.
Each account maintains an archive of all discovered songs. A song can be pushed from archive to queue, in which process it receives an address and can be payed for.
Insert song into the archive for this account.
Example request:
POST /songs/abc
[
{
"id": "songid",
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234, // optional
},
....
]
Response:
201 - created
Retrieve songs from the archive of this account. Example request:
GET /songs/abc
Response:
[
{
"id": "/path/to/file.mp3",
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234, // optional
},
....
]
Retrieve all songs queue for playing.
Response:
[
{
"id": "songid",
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234, // optional
"sum": 1.23 //amount payed for in total, this is the order element
},
....
]
## (Drinker) PUT /queues/{account}
Push a song from archive into the queue. Example request:
PUT /queues/123
{"id":"songId"}
Response:
{
"id":"1683152235880559633",
"address":"nmxyz...", // payment address is added in this process
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234 // optional
}
Get the song to play. poll a song from the queue, push it onto the played history, and return the song data so the player can play it. Code 204 get's returned, if the queue is empty. Example request:
POST /queues/123
Response with a song: statusCode=200
{
"id":"1683152235880559633",
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234 // optional
}
Will hold the currently playing song + all previously played songs.
Retrieve songs from the play history. Example request:
GET /histories/abc
Response:
[
{
"id": "/path/to/file.mp3",
"title": "foo", // always present, defaults to filename minus extension
"artist": "foo", // optional
"album": "fooster", // optional
"length": 234, // optional
"playStarted": 1235454646 // ordered by this attribute
},
....
]
Create a new account for a new venue, returns the uuid. In the background the account's address-pool starts filling up.
POST http://eye.beatcoin.org/accounts
{
"uuid" : "07d545ae-4ffc-4cf6-b96b-3ba81cda4214"
}
## POST /accounts/{uuid}/reserveAddress
Pulls an address from the account's address-pool and marks it as reserved. Awaiting payments on it.
POST http://eye.beatcoin.org/accounts/07d545ae-4ffc-4cf6-b96b-3ba81cda4214/reserveAddress
{
"address" : "mkX1fMJE6awQ7xHjGAWx7Dh9HAsLuYkTa7",
"account" : "07d545ae-4ffc-4cf6-b96b-3ba81cda4214"
}
Returns 200 on success, 412 if not yet initialised, and 416 if pool is empty. The client is then excepted to reuse an address previously reserved. The reservation does not require to be renewed.
## POST /accounts/{uuid}/releaseAddress
Releases an address and returns it into the address pool.
POST http://eye.beatcoin.org/accounts/07d545ae-4ffc-4cf6-b96b-3ba81cda4214/releaseAddress
Returns 204 on success, 412 if not yet initialised, and 404 if this address was not in the pool or not reserved.
When BitcoinEye starts up it first synchronises with BitcoinD. Once synchronisation is complete, it will notify the client application. On every pool initialisation message from BitcoinEye the client app should remap all addresses. This message indicates, that all reservations have been lost/no address is reserved.
{
"subject":"status",
"status":"pool initialized"
}
on every received transaction a configured url will be called. http method post will deliver the following data:
{
"subject":"payment",
"payment":{
"address":"mkX1fMJE6awQ7xHjGAWx7Dh9HAsLuYkTa7",
"amount":0.1,
"time":1382820185,
"account":"2de8efcc-74eb-444b-8d92-b49d51861185"
}
}