RESTful API endpoints to manage photos
Headers
As this API is working with JSON every request must add the following headers:
Accept: application/json
And for requests with body:
Content-Type: application/json
Photos management
Resource Group ¶
Photos upload ¶
Upload photoPOST/public
Example URI
POST https://monolith.spotahome.com/api/photos/public
Request
BinaryHeaders
Content-Type: multipart/form-data; boundary=---boundary---
Authorization: aa.bb.ccBody
---boundary---,
Content-Disposition: form-data; name="imageFile"; filename="/home/user/photo.jpg
---boundary---
Content-Disposition: form-data; name="propertyId"
123456
---boundary---Request
By URLHeaders
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"imageUrl": "https://s3.amazon.com/photos-bucket/photo.jpg",
"propertyId": "12345"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"imageUrl": {
"type": "string"
},
"propertyId": {
"type": "string"
}
},
"required": [
"imageUrl",
"propertyId"
]
}Response
201Headers
Location: /api/photos/public/8da003d43506937ee1975c58ab3c2d9578ef145f55a53e7826deb9a1Response
401Headers
Content-Type: application/jsonBody
{
"detail": "Unauthorized user",
"status": 401,
"title": "Unauthorized",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
415Headers
Content-Type: application/jsonBody
{
"detail": "The Content-Type * of the request is not currently supported.",
"status": 415,
"title": "Unsupported Media Type",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
422Headers
Content-Type: application/jsonBody
{
"detail": "The request was well formed but was unable to be followed due to semantic errors",
"status": 422,
"title": "Unprocessable Entity",
"type": "`http://www.w3.org/Protocols/rfc2616/rfc2616",
"validationMessages": {
"field": {
"stringLength": "The input is less than 6 characters long"
}
}
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string",
"description": "sec10.html (string, required)"
},
"validationMessages": {
"type": "object",
"properties": {
"field": {
"type": "object",
"properties": {
"stringLength": {
"type": "string"
}
},
"required": [
"stringLength"
]
}
},
"description": "Contains a property for each field that failed validation."
}
},
"required": [
"detail",
"status",
"title"
]
}Response
500Headers
Content-Type: application/jsonBody
{
"detail": "Internal Server Error",
"status": 500,
"title": "Internal Server Error",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Photos operations ¶
Delete photoDELETE/public/{id}
Example URI
DELETE https://monolith.spotahome.com/api/photos/public/8da003d43506937ee1975c58ab3c2d9578ef145f55a53e7826deb9a1
URI Parameters
- id
string(required) Example: 8da003d43506937ee1975c58ab3c2d9578ef145f55a53e7826deb9a1
Request
Headers
Authorization: aa.bb.ccResponse
204Response
401Headers
Content-Type: application/jsonBody
{
"detail": "Unauthorized user",
"status": 401,
"title": "Unauthorized",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
404Headers
Content-Type: application/jsonBody
{
"detail": "The resource was not found",
"status": 404,
"title": "Not Found",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
500Headers
Content-Type: application/jsonBody
{
"detail": "Internal Server Error",
"status": 500,
"title": "Internal Server Error",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Classify photoPUT/public/{id}
Example URI
PUT https://monolith.spotahome.com/api/photos/public/8da003d43506937ee1975c58ab3c2d9578ef145f55a53e7826deb9a1
URI Parameters
- id
string(required) Example: 8da003d43506937ee1975c58ab3c2d9578ef145f55a53e7826deb9a1
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"caption": "Living room",
"taxonomy": "bedroom"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"caption": {
"type": "string"
},
"taxonomy": {
"type": "string",
"enum": [
"bedroom",
"balcony",
"terrace",
"street-view",
"living-room",
"checked-by",
"corridor",
"kitchen",
"bathroom",
"ensuite-bathroom",
"garden",
"parking",
"building",
"guest-room",
"tenants-living-room",
"tenants-kitchen",
"tenants-bathroom",
"shower",
"toilet",
"view",
"patio-terrace",
"courtyard",
"stairs",
"loft",
"storage",
"entrance-hall",
"swimming-pool",
"other",
"uncategorized",
"residence-bedroom",
"residence-studio",
"residence-ensuite",
"residence-bathroom",
"residence-living-room",
"residence-view-from-window",
"residence-kitchen",
"residence-corridor",
"residence-entrance",
"residence-hallway",
"residence-checked-by",
"residence-restaurant",
"residence-cafeteria",
"residence-bar",
"residence-nightclub",
"residence-games-hall",
"residence-library",
"residence-swimming-pool",
"residence-gym",
"residence-library-study-area",
"residence-concierge",
"residence-reception",
"residence-common-area",
"residence-lounge",
"residence-quite-lounge",
"residence-study-room",
"residence-study-area",
"residence-tv-room",
"residence-cinema",
"residence-entertainment-zone",
"residence-outdoor-area",
"residence-garden",
"residence-laundry",
"residence-recreation-room",
"residence-first-aid-room",
"residence-other"
]
}
},
"required": [
"caption",
"taxonomy"
]
}Response
204Response
400Headers
Content-Type: application/jsonBody
{
"detail": "The request could not be understood by the server due to malformed syntax",
"status": 400,
"title": "Bad Request",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
401Headers
Content-Type: application/jsonBody
{
"detail": "Unauthorized user",
"status": 401,
"title": "Unauthorized",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
404Headers
Content-Type: application/jsonBody
{
"detail": "The resource was not found",
"status": 404,
"title": "Not Found",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
500Headers
Content-Type: application/jsonBody
{
"detail": "Internal Server Error",
"status": 500,
"title": "Internal Server Error",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Photos operations multiple ¶
Classify multiple photosPUT/public/multiple
Example URI
PUT https://monolith.spotahome.com/api/photos/public/multiple
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"photos": [
{
"photoId": "adf45d949a029545dcb13b5d6228c140eb54d755fba2c82b04a88424",
"caption": "Living room",
"taxonomy": "bedroom"
}
]
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"photos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"photoId": {
"type": "string",
"enum": [
"adf45d949a029545dcb13b5d6228c140eb54d755fba2c82b04a88424"
]
},
"caption": {
"type": "string",
"enum": [
"Living room"
]
},
"taxonomy": {
"type": "string",
"enum": [
"bedroom",
"balcony",
"terrace",
"street-view",
"living-room",
"checked-by",
"corridor",
"kitchen",
"bathroom",
"ensuite-bathroom",
"garden",
"parking",
"building",
"guest-room",
"tenants-living-room",
"tenants-kitchen",
"tenants-bathroom",
"shower",
"toilet",
"view",
"patio-terrace",
"courtyard",
"stairs",
"loft",
"storage",
"entrance-hall",
"swimming-pool",
"other",
"uncategorized",
"residence-bedroom",
"residence-studio",
"residence-ensuite",
"residence-bathroom",
"residence-living-room",
"residence-view-from-window",
"residence-kitchen",
"residence-corridor",
"residence-entrance",
"residence-hallway",
"residence-checked-by",
"residence-restaurant",
"residence-cafeteria",
"residence-bar",
"residence-nightclub",
"residence-games-hall",
"residence-library",
"residence-swimming-pool",
"residence-gym",
"residence-library-study-area",
"residence-concierge",
"residence-reception",
"residence-common-area",
"residence-lounge",
"residence-quite-lounge",
"residence-study-room",
"residence-study-area",
"residence-tv-room",
"residence-cinema",
"residence-entertainment-zone",
"residence-outdoor-area",
"residence-garden",
"residence-laundry",
"residence-recreation-room",
"residence-first-aid-room",
"residence-other"
]
}
},
"required": [
"photoId",
"caption",
"taxonomy"
],
"additionalProperties": false
}
}
},
"required": [
"photos"
]
}Response
204Response
400Headers
Content-Type: application/jsonBody
{
"detail": "The request could not be understood by the server due to malformed syntax",
"status": 400,
"title": "Bad Request",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
401Headers
Content-Type: application/jsonBody
{
"detail": "Unauthorized user",
"status": 401,
"title": "Unauthorized",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
404Headers
Content-Type: application/jsonBody
{
"detail": "The resource was not found",
"status": 404,
"title": "Not Found",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}Response
500Headers
Content-Type: application/jsonBody
{
"detail": "Internal Server Error",
"status": 500,
"title": "Internal Server Error",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"detail": {
"type": "string"
},
"status": {
"type": "number"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"detail",
"status",
"title",
"type"
]
}