-
Notifications
You must be signed in to change notification settings - Fork 5
API Documentation
This is where the REST API rests:
ec2-18-196-2-56.eu-central-1.compute.amazonaws.com:3000/api/
Content-Type: "application/json"
Authorization: "Token {Token}"
Create new user
Request
{
"username": String, (required)
"email": String, (required)
"password": String, (required)
"location": String, (optional)
"gender": String, (optional)
"photo_path": String (optional)
}
Response
201 Created
{
"profile": {
"id": Integer,
"username": String,
"location": String,
"gender": String,
"photo_path": String,
"user": Integer
},
"user": {
"email": String,
"username": String
}
}
400 Bad Request
{ field: [error] }
authenticate user with email and password, return token
Request
{
"username": String, (required)
"email": String, (optional)
"password": String (required)
}
Response
200 OK
{
"token": Token
}
400 Bad Request
{ field: [error] }
delete user token from database
Response
200 OK
401 Unauthorized
{
"detail": "Invalid token."
}
get all users
Response
200 OK
[
{
"email": String,
"username": String
},
]
404 Not Found
Create new heritage item
Request
{
"title": String, (required)
"description": String, (required)
"event_date": String, (optional)
"location": String, (optional)
"tags": [
{
"name": String,
},
] (required, send empty list if there are no tags)
}
Response
201 Created
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"is_upvoted": Boolean,
"is_downvoted": Boolean,
"is_owner": Boolean,
"tags": [
{
"id": Integer,
"name": String
},
],
"media":[
{
"id": Integer,
"heritage": Integer,
"image": URL,
"creation_date": Datetime,
"update_date": Datetime
},
],
"creator_username": String,
"creator_image_path": URL,
"title": String,
"description": String,
"creation_date": Datetime,
"event_date": Datetime,
"location": String,
"creator": Integer
}
400 Bad Request
{ field: [error] }
401 Unauthorized
{ "detail": [error] }
get all heritage items
Response
200 OK
[
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"is_upvoted": Boolean,
"is_downvoted": Boolean,
"is_owner": Boolean,
"tags": [
{
"id": Integer,
"name": String
},
],
"media":[
{
"id": Integer,
"heritage": Integer,
"image": URL,
"creation_date": Datetime,
"update_date": Datetime
},
],
"creator_username": String,
"creator_image_path": URL,
"title": String,
"description": String,
"creation_date": Datetime,
"event_date": Datetime,
"location": String,
"creator": Integer
},
]
404 Not Found
Get heritage items sorted by their votes
Response is the same as GET /items/
Get heritage items sorted by the increase in their votes in the last week
Response is the same as GET /items/
Get heritage items sorted by their creation dates.
Response is the same as GET /items/
get heritage item by id
Response
200 OK
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"is_upvoted": Boolean,
"is_downvoted": Boolean,
"is_owner": Boolean,
"tags": [
{
"id": Integer,
"name": String
},
],
"media":[
{
"id": Integer,
"heritage": Integer,
"image": URL,
"creation_date": Datetime,
"update_date": Datetime
},
],
"creator_username": String,
"creator_image_path": URL,
"title": String,
"description": String,
"creation_date": Datetime,
"event_date": Datetime,
"location": String,
"creator": Integer
}
404 Not Found
update the heritage item which is indicated by id
Response
200 OK
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"is_upvoted": Boolean,
"is_downvoted": Boolean,
"is_owner": Boolean,
"tags": [
{
"id": Integer,
"name": String
},
],
"media":[
{
"id": Integer,
"heritage": Integer,
"image": URL,
"creation_date": Datetime,
"update_date": Datetime
},
],
"creator_username": String,
"creator_image_path": URL,
"title": String,
"description": String,
"creation_date": Datetime,
"event_date": Datetime,
"location": String,
"creator": Integer
}
400 Bad Request
{ field: [error] }
404 Not Found
412 Precondition Failed
delete the heritage item which is indicated by id
Response
200 OK
204 No Content
404 Not Found
get all comments of the heritage item indicated by id
Response
200 OK
[
{
"id": Integer,
"is_owner": Boolean,
"creator_image_path": URL,
"creator_username": string,
"text": string,
"creation_date": Datetime,
"update_date": Datetime,
"heritage": Integer,
"creator": Integer,
"parent_comment": Integer (can be null)
},
]
404 Not Found
get all tags of the heritage item indicated by id
Response
200 OK
[
{
"id": Integer,
"name": String,
},
]
404 Not Found
Create new comment
Request
{
"text": String, (required)
"heritage": Integer, (required)
"parent_comment": Integer (optional)
}
Response
201 Created
{
"id": Integer,
"is_owner": Boolean,
"creator_image_path": URL,
"creator_username": string,
"text": string,
"creation_date": Datetime,
"update_date": Datetime,
"heritage": Integer,
"creator": Integer,
"parent_comment": Integer (can be null)
}
400 Bad Request
{ field: [error] }
401 Unauthorized
{ "detail": [error] }
get the comment by id
Response
200 OK
{
"id": Integer,
"is_owner": Boolean,
"creator_image_path": URL,
"creator_username": string,
"text": string,
"creation_date": Datetime,
"update_date": Datetime,
"heritage": Integer,
"creator": Integer,
"parent_comment": Integer (can be null)
}
404 Not Found
delete the comment that is indicated by id
Response
200 OK
204 No Content
404 Not Found
Create new vote
Request
{
"value": Boolean, (required)
"heritage": Integer (required)
}
Response
201 Created
{
"id": Integer,
"value": Boolean,
"creation_date": DateTime,
"update_date": DateTime,
"voter": Integer,
"heritage": Integer,
"upvote_count": Integer,
"downvote_count": Integer
}
400 Bad Request
{ field: [error] }
401 Unauthorized
{ "detail": [error] }
Deletes the existing vote of the requester
Request
{
"heritage": Integer (required)
}
Response
200 Ok
action successfully done
{
"upvote_count": Integer,
"downvote_count": Integer
}
404 Not Found
Means there is no old vote in the DB to specified heritage item ID or it is already deleted.
HTTP_412_PRECONDITION_FAILED
Probably there is no heritage field in the request or something else is wrong about the request.
get all user profiles
Response
200 OK
[
{
"id": Integer,
"username": String,
"location": String,
"gender": String,
"photo_path": String,
"user": Integer
},
]
404 Not Found
get user profile by id
Response
200 OK
{
"id": Integer,
"username": String,
"location": String,
"gender": String,
"photo_path": String,
"user": Integer
}
404 Not Found
get all tags
Response
200 OK
[
{
"id": Integer,
"name": String,
},
]
404 Not Found
get all heritage items own the tag indicated by id
Response
200 OK
[
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"tags": [
{
"id": Integer,
"name": String,
"category": String
},
],
"title": String,
"description": String,
"creation_date": DateTime,
"event_date": DateTime,
"location": String,
"creator": Integer
},
]
404 Not Found
searches heritage items
Request
[
{
"query": String, (Required)
"filters":{
"location": String, (optional)
"creator": String, (optional)
"creation_start": datetime, (optional)
"creation_end": datetime, (optional)
"event_start": datetime, (optional)
"event_end": datetime, (optional)
} (optional)
}
]
Response
[
{
"id": Integer,
"upvote_count": Integer,
"downvote_count": Integer,
"is_upvoted": Boolean,
"is_downvoted": Boolean,
"is_owner": Boolean,
"tags": [
{
"id": Integer,
"name": String
},
],
"media":[
{
"id": Integer,
"heritage": Integer,
"image": URL,
"creation_date": Datetime,
"update_date": Datetime
},
],
"creator_username": String,
"creator_image_path": URL,
"title": String,
"description": String,
"creation_date": Datetime,
"event_date": Datetime,
"location": String,
"creator": Integer
},
]
create annotation on the description of the heritage item
Request
{
"text": String, (Required),
"coordinates": [ Integer, Integer ]
}
Response
201 Created
400 Bad Request
get annotations of a heritage item indicated by id
Response
200 OK
[
{
"annotatedAt": DateTimeString,
"body": String,
"@id": String,
"serializedAt": DateTimeString,
"target": String
},
]
create annotation on the media file of the heritage item
Request
{
"text": String, (Required),
"coordinates": [ Integer, Integer, Integer, Integer ]
}
Response
201 Created
400 Bad Request
create annotation on the comment of the heritage item
Request
{
"text": String, (Required),
"coordinates": [ Integer, Integer ]
}
Response
201 Created
400 Bad Request
get all annotations
Response
200 OK
[
{
"annotatedAt": DateTimeString,
"body": String,
"@id": String,
"serializedAt": DateTimeString,
"target": String
},
]
create a video or change an old video of the heritage item
Request
{
"video_url": String,
"heritage" : Int(heritage id)
}
Response
201 Created
400 Bad Request
get the video with the given id
ps: there should be no need to use this GET function since video object is also returned in the heritage serializer in the "video" field
Response
200 OK
{
"id" : Int,
"video_url": String,
"creation_date": DateTimeString,
"update_date": DateTimeString,
"heritage": Int(Heritage id)
}
delete the video with the given id
Response
204 NO CONTENT (Successfully Deleted)
412 Precondition Failed
- Meeting 1 - 07.02.2017
- Meeting 2 - 16.02.2017
- Meeting 3 - 21.02.2017
- Meeting 4 - 23.03.2017
- Customer Meeting 1 - 02.03.2017
- Meeting 5 - 01.03.2017
- Meeting 6 - 08.03.2017
- Meeting 7 - 15.03.2017
- Meeting 8 - 07.05.2017
- Meeting 9 - 15.05.2017
- Meeting 10 - 24.09.2017
- Meeting 11 - 02.10.2017
- Meeting 12 - 19.10.2017
- Meeting 13 - 02.11.2017
- Meeting 14 - 09.11.2017
- Meeting 15 - 27.11.2017