var blob1 = {
"blobID": "ofnlcsofagunpoavtrcnw",
"heading": "Grass is always greener on the other side.",
"description": "This is a wonderful day =)",
"creator": "Dary",
"dataURL": "data:image/gif;base64,..." // <-- das eigentliche bild
}
var event1 = {
"verb": "newBlob",
"blobID": "ofnlcsofagunpoavtrcnw"
}
var event2 = {
"verb": "addVote", // auch noch "removeVote"
"voter": "Dary",
"blobID": "ofnlcsofagunpoavtrcnw"
}
REST endpoints
[x] Get recent events: GET/events/recent/NUMBER
-> Results in zB: [ event1, event2, ... ]
[x] Get a blob: GET/blob/get/blobID
-> Results in zB: blob1
[x] Add a blob: POST/blob/create
-> Per POST das blob-Objekt an den Server schicken.
[x] Add a vote: POST/blob/vote
-> Per POST das vote-Objekt (zB. event2) an server schicken.
Rest API
Sourcecode: https://github.com/blob-stream/rest-server Online demo: https://pguth.github.io/blob-stream
Object definitions
REST endpoints
GET
/events/recent/NUMBER
-> Results in zB:
[ event1, event2, ... ]
GET
/blob/get/blobID
-> Results in zB:
blob1
POST
/blob/create
-> Per POST das blob-Objekt an den Server schicken.
POST
/blob/vote
-> Per POST das vote-Objekt (zB.
event2
) an server schicken.Functionality
rest-middleman <---> {website, MacOS, rest-middleman}