This is a backend for the Arte Guapulo project for Ser y Cosmos, it serves the gallery images and its metadata.
GET routes available:
Get metadata of all the pieces.
GET $API_URL$/api/piece/meta
{
"status": 200,
"success": true,
"data": {
"quantity": 3,
"ids": [
"123",
"234",
"456",
"987"
]
}
}
Get data of a particular piece.
GET $API_URL$/api/piece/:id
PARAM
id
: ID of the piece to get.
{
"status": 200,
"success": true,
"data": {
"image": "http://site.tld/image.jpg",
"coordinates": {
"latitude": 0,
"longitude": 70
},
"authors": [
{
"instagram": null,
"twitter": null,
"facebook": "facebook.handle",
"justName": null
}
],
"id": "123",
"tags": [
"hello",
"tag2"
]
}
}
Get data on all pieces.
GET $API_URL$/api/piece/all
{
"status": 200,
"success": true,
"data": [
{
"image": "http://site.tld/image.jpg",
"coordinates": {
"latitude": 0,
"longitude": 70
},
"authors": [
{
"instagram": null,
"twitter": null,
"facebook": "facebook.handle",
"justName": null
}
],
"id": "123",
"tags": [
"hello",
"tag2"
]
},
{
"image": "http://site.tld/image.png",
"coordinates": {
"latitude": 10,
"longitude": 20
},
"authors": [
{
"instagram": "instagram.handle",
"twitter": null,
"facebook": "facebook.handle",
"justName": null
}
],
"id": "234",
"tags": [
"tag1",
"tag2",
"tag3",
"tag4"
]
},
]
}
POST routes available:
Create a new piece. Send the piece data in the request body.
POST $API_URL$/api/piece/create
Required body: application/json.
Example Body:
{
"image": "http://site.tld/image.png",
"coordinates": {
"latitude": 10,
"longitude": 20
},
"authors": [
{
"instagram": "instagram.handle",
"twitter": null,
"facebook": "facebook.handle",
"justName": null
},
{
"instagram": null,
"twitter": null,
"facebook": null,
"justName": "SocialNA"
}
],
"id": "234",
"tags": [
"tag1",
"tag2",
"tag3",
"tag4"
]
}
{
"status": 201,
"success": true,
"data": {
"writeTime": 0.800,
"document": {
"image": "http://site.tld/image.png",
"coordinates": {
"latitude": 10,
"longitude": 20
},
"authors": [
{
"instagram": "instagram.handle",
"twitter": null,
"facebook": "facebook.handle",
"justName": null
},
{
"instagram": null,
"twitter": null,
"facebook": null,
"justName": "SocialNA"
}
],
"id": "234",
"tags": [
"tag1",
"tag2",
"tag3",
"tag4"
]
}
}
}
PUT routes available:
Update a particular piece with only the data that needs to be updated.
Use object.property
as a property of the body to replace only that sub-property.
Arrays need to be complete if they're updated.
PUT $API_URL$/api/piece/update/:id
PARAM
id
: ID of the piece to update.
Required body: application/json.
Example Body:
{
"image": "http://newurl.tld/newimage.jpg",
"coordinates.latitude": 10,
"coordinates.longitude": 20,
"authors": [
{
"facebook": "new.fb.handle",
"instagram": null,
"twitter": "old.tw.handle",
"justName": null
}
]
}
{
"status": 200,
"success": true,
"data": {
"writeTime": 0.3,
"updated": {
"image": "http://newurl.tld/newimage.jpg",
"coordinates": {
"latitude": 10,
"longitude": 20
},
"authors": [
{
"facebook": "new.fb.handle",
"instagram": null,
"twitter": "old.tw.handle",
"justName": null
}
],
"tags": [
"oldtag1",
"oldtag2"
],
"id": "123123123"
}
}
}
DELETE routes available:
Delete a particular piece.
DELETE $API_URL$/api/piece/delete/:id
PARAM
id
: ID of the piece to delete.
{
"status": 200,
"success": true,
"data": {
"writeTime": 0.4
}
}
This API was made by moonstar-x.