Practice App API Documentation - bounswe/bounswe2022group7 GitHub Wiki

Practice App API

You can also view the online version of the API documentation here.

Overview

API for Practice Application of Group 7. A collaborative art platform, ArtShare.

Version information

Version : 1.0

Paths

Endpoint to view 5 available art galleries

GET /api/art_galleries

Responses

HTTP Code Description Schema
200 The sign up was successful. < Response 200 > array

Response 200

Name Description Schema
address
optional
Address of the art gallery
Example : "Suite 867 8602 Schroeder Point, East Guillermo, NE 00680-8089"
string
name
optional
Name of the art gallery
Example : "West Loriaview Art Gallery"
string

Endpoint to create an art item object

POST /api/art_item

Parameters

Type Name Description Schema
Body content_uri
required
The link to the resource file of the art item (image, gif, etc.) string
Body description
required
The informative text about the art item string
Body name
required
Name of the art item string

Responses

HTTP Code Description Schema
201 Art item with the given data is successfully created. Response 201
400 Missing required parameters. No Content
401 Access token is missing or invalid. No Content
409 Duplicate art item tried to be created. No Content

Response 201

Name Description Schema
id
required
ID of the newly created art item
Example : 37
integer

Security

Type Name
apiKey BearerAuth

Endpoint to fetch an art item with a given ID

GET /api/art_item/{art_item_id}

Parameters

Type Name Description Schema
Path art_item_id
required
ID of the art item integer

Responses

HTTP Code Description Schema
200 Art item with the given ID is successfully fetched. Response 200
404 There are no art items with the given ID. No Content

Response 200

Name Description Schema
content_uri
required
The link to the resource file of the art item (image, gif, etc.)
Example : "https://en.wikipedia.org/wiki/The_Starry_Night#/media/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"
string
creation_date
required
The date when the art item is created
Example : "2022-05-17"
string
creator_artist
required
User ID of the creator of the art item
Example : 29
integer
description
required
The informative text about the art item
Example : "The Starry Night is an oil-on-canvas painting by the Dutch Post-Impressionist painter Vincent van Gogh."
string
dominant_colors
required
List of the dominant colors in the art item's content.
Example : [ "orange crush", "graphite" ]
< string > array
id
required
ID of the art item
Example : 37
integer
name
required
Name of the art item
Example : "The Starry Night"
string

Endpoint to create an copyright report object

POST /api/copyright

Parameters

Type Name Description Schema
Body description
required
The informative text about the report string
Body infringement_art_item_id
required
ID of the infringement art item string
Body original_art_item_id
required
ID of the original art item string

Responses

HTTP Code Description Schema
201 Report with the given data is successfully created. Response 201
400 Original art item and infringement art item must be different. No Content
404 Art Item with id : <art_item_id> does not exists. No Content

Response 201

Name Description Schema
id
required
ID of the newly created report
Example : 5
integer

Security

Type Name
apiKey BearerAuth

Endpoint to remove an reported art item object

DELETE /api/copyright

Parameters

Type Name Description Schema
Body art_item_id
required
ID of the reported art item string

Responses

HTTP Code Description Schema
200 Reported art item is successfully removed. Response 200
400 You have not provided some of the required fields. No Content
404 There are no Art Item with the id <art_item_id>. No Content

Response 200

Name Description Schema
id
required
ID of the removed art item
Example : 46
integer

Security

Type Name
apiKey BearerAuth

Endpoint to fetch an copyright report with a given ID

GET /api/copyright/{report_id}

Parameters

Type Name Description Schema
Path report_id
required
ID of the Copyright Infringement Report integer

Responses

HTTP Code Description Schema
200 Copyright Infringement Report with the given ID is successfully fetched. Response 200
404 There are no reports with the id <report_id>. No Content

Response 200

Name Description Schema
creation_date
required
The date when the report is created
Example : "2022-05-17"
string
creator
required
User ID of the report creator
Example : 2
integer
creator_name
required
Name of the report creator
Example : "Brian Tennison"
string
description
required
The informative text about the report
Example : "These two art items are too similar, there might be a copyright infringement."
string
id
required
ID of the report
Example : 5
integer
infringement_art_creation_date
required
The date when the infringement art item is created
Example : "2022-05-19"
string
infringement_art_item_id
required
ID of the infringement art item
Example : 46
integer
infringement_art_name
required
Name of the infringement art item
Example : "The Starry Night Recreation"
string
infringement_art_uri
required
The link to the resource file of the infringement art item (image, gif, etc.)
Example : "https://cdn.shopify.com/s/files/1/0839/9135/products/Starry_Night_final_large.jpg?v=1438585349"
string
original_art_creation_date
required
The date when the original art item is created
Example : "2022-05-17"
string
original_art_item_id
required
ID of the original art item
Example : 37
integer
original_art_name
required
Name of the original art item
Example : "The Starry Night"
string
original_art_uri
required
The link to the resource file of the original art item (image, gif, etc.)
Example : "https://en.wikipedia.org/wiki/The_Starry_Night#/media/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"
string
similarity_score
required
Number that shows the similarity between the reported art items, Smaller the value, similar the images
Example : 5
integer

Security

Type Name
apiKey BearerAuth

Endpoint to create an event object

POST /api/event

Parameters

Type Name Description Schema
Body city
required
City where the event takes place string
Body date
required
Date of the event string
Body description
required
The informative text about the art item string
Body poster_link
required
Link to the event poster string
Body title
required
Title of the event string

Responses

HTTP Code Description Schema
201 Event with the given data is successfully created. Response 201
400 Date you have entered is not valid. Format is "%Y-%m-%d". You entered "". No Content
401 Missing Authorization Header No Content
409 Please enter a title that doesn't exist in the platform. No Content

Response 201

Name Description Schema
id
required
ID of the newly created event
Example : 2
integer

Security

Type Name
apiKey BearerAuth

Endpoint to fetch an event with a given ID

GET /api/event/{event_id}

Parameters

Type Name Description Schema
Path event_id
required
ID of the event integer

Responses

HTTP Code Description Schema
200 Art item with the given ID is successfully fetched. Response 200
404 There are no events with the id <event_id>. No Content

Response 200

Name Description Schema
artist_id
required
ID of the creator artist
Example : 2
integer
artist_name
required
Name of the artist
Example : "Ivan Aivazovsky"
string
city
required
City where the event takes place
Example : "Istanbul"
string
date
required
Date of the event
Example : "Fri, 01 Apr 2022 00:00:00 GMT"
string
description
required
The informative text about the event
Example : "An event to feel as if you are cruising in the ocean without setting foot on a boat."
string
id
required
Id of the event
Example : 3
integer
poster_link
required
Link to the event poster
Example : "https://en.wikipedia.org/wiki/Ivan_Aivazovsky#/media/File:Aivazovsky_-_Self-portrait_1874.jpg"
string
title
required
Title of the event.
Example : "The Aivazovsky Day"
string
weather
required
Information about the current weather at the event location weather

weather

Name Description Schema
temp
optional
Temparature at the event location
Example : "13.17 C"
string
weather
optional
Description of the weather condition
Example : "Rain"
string

Endpoint to create a forum post comment object

POST /api/forum_comment_post

Parameters

Type Name Description Schema
Body content_uri
required
The link to the image to be attached to the comment (image, gif, etc.) string
Body parent_post
required
ID of the parent forum post integer
Body text
required
The body of the comment to be posted under the discussion post string

Responses

HTTP Code Description Schema
201 A comment with the given data is successfully created. Response 201
400 Missing required parameters. No Content
401 Access token is missing or invalid. No Content

Response 201

Name Description Schema
id
required
ID of the newly created comment
Example : 15
integer

Security

Type Name
apiKey BearerAuth

Endpoint to fetch all forum posts in database.

GET /api/forum_get/

Responses

HTTP Code Description Schema
200 Forum posts in database are successfully fetched. Response 200
500 Error while extracting posts from database. No Content

Response 200

Name Description Schema
results
required
Array of all forum posts in database.
Example : ""
< object > array

Endpoint to create a new forum post

POST /api/forum_post/

Parameters

Type Name Description Schema
Body content_uri
optional
The link to the resource file of the visual content being shared (image, gif, etc.) string
Body description
required
The main textual body of the forum post. string
Body title
optional
Title for the forum post string

Responses

HTTP Code Description Schema
201 Forum post is successfully added to the cluster. Response 201
500 Error recording post to database. No Content

Response 201

Name Description Schema
id
required
ID of the newly created forum post.
Example : 47
integer

Security

Type Name
apiKey BearerAuth

Endpoint to fetch a forum post with a given ID

GET /api/get_discussion_post/{post_id}

Parameters

Type Name Description Schema
Path post_id
required
ID of the forum post integer

Responses

HTTP Code Description Schema
200 Forum post with the given ID is successfully fetched. Response 200
404 There is no forum post with the given ID. No Content

Response 200

Name Description Schema
comments
required
a list of comments written under the forum post
Example : [ {<br> "content_uri" : "https://random.imagecdn.app/500/150",<br> "creation_date" : "Wed, 18 May 2022 00:00:00 GMT",<br> "creator" : 5,<br> "id" : 35,<br> "name" : "Johnny Depp",<br> "parent_post" : 7,<br> "text" : "Great forum post!",<br> "translation" : "Harika bir forum yazisi!"<br>} ]
< comments > array
post
required
Post information
Example : {<br> "content_uri" : "https://random.imagecdn.app/500/150",<br> "creation_date" : "Wed, 9 May 2022 00:00:00 GMT",<br> "creator" : 9,<br> "description" : "This is the description of the post",<br> "id" : 23,<br> "title" : "Starry Night",<br> "user_name" : "Michael Jackson"<br>}
post

comments

Name Description Schema
content_uri
required
The link to the image attached to the comment (image, gif, etc.)
Example : "https://random.imagecdn.app/500/150"
string
creation_date
required
Date of creation of the comment
Example : "Wed, 15 May 2022 00:00:00 GMT"
string
creator
required
ID of the creator of the comment
Example : 5
integer
id
required
ID of the comment
Example : 35
integer
name
required
name of the creator of the comment
Example : "Johnny Depp"
string
parent_post
required
ID of the parent post
Example : 7
integer
text
required
The body of the comment to be posted under the discussion post
Example : "Great forum post!"
string
translation
required
The turkish translation of the body of the comment posted under the discussion post
Example : "Harika bir forum yazisi!"
string

post

Name Description Schema
content_uri
required
The link to the image attached to the forum post (image, gif, etc.)
Example : "https://random.imagecdn.app/500/150"
string
creation_date
required
Date of creation of the forum post
Example : "Wed, 9 May 2022 00:00:00 GMT"
string
creator
required
ID of the creator of the post
Example : 9
integer
description
required
Description of the forum post
Example : "This is the description of the post"
string
id
required
ID of the forum post
Example : 23
integer
title
required
The title of the forum post
Example : "Starry Night"
string
user_name
required
The name of the user who created the forum post
Example : "Michael Jackson"
string

Endpoint to login

POST /api/login

Parameters

Type Name Description Schema
Body email
required
Email of the new user string
Body password
required
Password of the new user string

Responses

HTTP Code Description Schema
200 The sign up was successful. Response 200
401 Incorrect email or password. No Content

Response 200

Name Description Schema
access_token
required
An access token for the logged in user to access restricted content
Example : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuYXV0aDAuY29tLyIsImF1ZCI6Imh0dHBzOi8vYXBpLmV4YW1wbGUuY29tL2NhbGFuZGFyL3YxLyIsInN1YiI6InVzcl8xMjMiLCJpYXQiOjE0NTg3ODU3OTYsImV4cCI6MTQ1ODg3MjE5Nn0.CA7eaHjIHz5NxeIJoFK9krqaeZrPLwmMmgI_XiQiIkQ"
string

Endpoint to add a participant to given event

POST /api/participants/add/{event_id}

Parameters

Type Name Description Schema
Path event_id
required
ID of the event integer

Responses

HTTP Code Description Schema
201 User is added succesfully as participant to event. Response 201
404 Event with given parameter ID cannot be found. Response 404
409 Happens when the user already participates in the event. Response 409
500 Server cannot process the call, there was an error probably regarding the database. Response 500

Response 201

Name Description Schema
success
required
Success Message
Example : "Successfully added the participant."
string

Response 404

Name Description Schema
error
required
Error Message
Example : "There are no events with the given ID."
string

Response 409

Name Description Schema
error
required
Error Message
Example : "User already participating"
string

Response 500

Name Description Schema
error
required
Error Message
Example : "There was an error adding the user as a participant to event."
string

Security

Type Name
apiKey BearerAuth

Endpoint to remove participant(s) from given event

POST /api/participants/remove/{event_id}

Parameters

Type Name Description Schema
Path event_id
required
ID of the event integer
Body participants
optional
An array to hold participant's ID string

Responses

HTTP Code Description Schema
200 Participants for event removed successfully. Response 200
400 Given request body was erroneous key/values were not matching with the schema. Response 400
403 Happens when the user tries to remove other participants and is not the creator. Response 403
404 Event with given parameter ID cannot be found. Response 404
409 Happens when the target user doesn;t participate in the event. Response 409
500 Server cannot process the call, there was an error probably regarding the database. Response 500

Response 200

Name Description Schema
success
required
Success Message
Example : "Successfully added the participant."
string

Response 400

Name Description Schema
error
required
Error Message
Example : "There was an error on key / value pairs on request body."
string

Response 403

Name Description Schema
error
required
Error Message
Example : "User is not the creator of the event"
string

Response 404

Name Description Schema
error
required
Error Message
Example : "There are no events with the given ID."
string

Response 409

Name Description Schema
error
required
Error Message
Example : "User does not participate in the event"
string

Response 500

Name Description Schema
error
required
Error Message
Example : "There was an error adding the user as a participant to event."
string

Security

Type Name
apiKey BearerAuth

Endpoint to get a share link for event with given ID

POST /api/participants/share/{event_id}

Parameters

Type Name Description Schema
Path event_id
required
ID of the event integer
Body page_url
required
URL of the target string

Responses

HTTP Code Description Schema
200 Participants for event removed successfully. Response 200
400 Given request body was erroneous key/values were not matching with the schema, or can be result of invalid link in the request. Response 400
404 Event with given parameter ID cannot be found. Response 404
409 A conflict happens on the API call Response 409
500 API call from backend fails, link couldn't be created. Response 500
502 An unexpected error occured on the server. Response 502

Response 200

Name Description Schema
share_link
required
Shortened URL
Example : "cutt.ly/ornek_link_addres"
string

Response 400

Name Description Schema
error
required
Error Message
Example : "There was an error on key / value pairs on request body."
string

Response 404

Name Description Schema
error
required
Error Message
Example : "There are no events with the given ID."
string

Response 409

Name Description Schema
error
required
Error Message
Example : "The link is already shortened"
string

Response 500

Name Description Schema
error
required
Error Message
Example : "Error when creating the share link. Try again later."
string

Response 502

Name Description Schema
error
required
Error Message
Example : "Unexpected error"
string

Security

Type Name
apiKey BearerAuth

Endpoint to list all participants of an event with given ID.

GET /api/participants/{event_id}

Parameters

Type Name Description Schema
Path event_id
required
ID of the event integer

Responses

HTTP Code Description Schema
200 Participants for event found successfully. Response 200
404 There are no events with the given ID." No Content

Response 200

Name Description Schema
event_title
required
Title of the event
Example : "Test Event"
string
is_creator
required
Parameter identifying if the user is the creator of the event.
Example : true
boolean
participants
required
An array containing id of all participants
Example : [ 1, 2, 29 ]
< object > array
user_participating
required
Identifies user's participation in the event
Example : false
boolean

Security

Type Name
apiKey BearerAuth

Endpoint to view profile of current user

GET /api/profile/

Responses

HTTP Code Description Schema
200 User is successfully fetched. Response 200
404 There is no user with the same id as token. No Content

Response 200

Name Description Schema
email
required
Email of user
Example : "[email protected]"
string
first_name
required
First name of user
Example : "Ali"
string
id
required
Id of user
Example : 3
integer
is_verified
required
True if user is verified
Example : true
boolean
last_name
required
Last name of user
Example : "Yılmaz"
string

Security

Type Name
apiKey BearerAuth

Endpoint to fetch all events and art items on the platform

GET /api/search

Parameters

Type Name Description Schema
Query query
optional
A keyword with which the content on the platform is filtered. string

Responses

HTTP Code Description Schema
200 Event and Art Item information succesfuly retrieved. Response 200

Response 200

Name Description Schema
art_items
required
List of art item data < art_items > array
events
required
List of event data < events > array

art_items

Name Description Schema
content_uri
optional
The link to the resource file of the art item (image, gif, etc.)
Example : "https://en.wikipedia.org/wiki/The_Starry_Night#/media/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"
string
creation_date
optional
The date when the art item is created
Example : "2022-05-17"
string
creator_artist
optional
User ID of the creator of the art item
Example : 29
integer
description
optional
The informative text about the art item
Example : "The Starry Night is an oil-on-canvas painting by the Dutch Post-Impressionist painter Vincent van Gogh."
string
id
optional
ID of the art item
Example : 37
integer
name
optional
Name of the art item
Example : "The Starry Night"
string

events

Name Description Schema
artist_id
optional
ID of the creator artist
Example : 2
integer
city
optional
City where the event takes place
Example : "Istanbul"
string
date
optional
Date of the event
Example : "Fri, 01 Apr 2022 00:00:00 GMT"
string
description
optional
The informative text about the event
Example : "An event to feel as if you are cruising in the ocean without setting foot on a boat."
string
id
optional
Id of the event
Example : 3
integer
poster_link
optional
Link to the event poster
Example : "https://en.wikipedia.org/wiki/Ivan_Aivazovsky#/media/File:Aivazovsky_-_Self-portrait_1874.jpg"
string
title
optional
Title of the event.
Example : "The Aivazovsky Day"
string

Endpoint to sign up

POST /api/signup

Parameters

Type Name Description Schema
Body email
required
Email of the new user string
Body first_name
required
First name of the new user string
Body is_artist
required
States whether the new user is an artist string
Body last_name
required
Last name of the new user string
Body password
required
Password of the new user string

Responses

HTTP Code Description Schema
201 The sign up was successful, a new user has been created. Response 201
409 A user with the specified email already exists. No Content

Response 201

Name Description Schema
access_token
required
An access token for the newly created user to access restricted content
Example : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuYXV0aDAuY29tLyIsImF1ZCI6Imh0dHBzOi8vYXBpLmV4YW1wbGUuY29tL2NhbGFuZGFyL3YxLyIsInN1YiI6InVzcl8xMjMiLCJpYXQiOjE0NTg3ODU3OTYsImV4cCI6MTQ1ODg3MjE5Nn0.CA7eaHjIHz5NxeIJoFK9krqaeZrPLwmMmgI_XiQiIkQ"
string

Endpoint to create a verification request

POST /api/verification/request

Responses

HTTP Code Description Schema
201 A verification request data is successfully created. Response 201
409 There is a request, whose status is 'Pending', for the user requesting verification. (OR) The user requesting verification is already verified. No Content
500 Server Error. No Content

Response 201

Name Description Schema
id
required
ID of the newly created request
Example : 14
integer

Security

Type Name
apiKey BearerAuth

Endpoint to review a verification request

POST /api/verification/review/{request_id}

Parameters

Type Name Description Schema
Body result
required
The decision for the verification request string

Responses

HTTP Code Description Schema
201 The decision for the request is processed succesfully. Response 201
404 There is no available request with the given id No Content
500 Server error. No Content

Response 201

Name Description Schema
id
required
ID of the processed request
Example : 37
integer
status
required
Status of the request
Example : 1
integer

Endpoint to fetch a verification request with a given ID

GET /api/verification/{request_id}

Parameters

Type Name Description Schema
Path request_id
required
ID of the verification request integer

Responses

HTTP Code Description Schema
201 Verification request with the given ID is successfully fetched. Response 201
404 There is no verification request with the given ID. No Content

Response 201

Name Description Schema
historical_event
required
A historical event that happened on the day the user requested verification
Example : "Ashina Jiesheshuai of the Eastern Turkic Khaganate failed in an attempt to assassinate Emperor Taizong of the Chinese Tang dynasty and was killed by pursuers."
string
id
required
ID of the verification request
Example : 9
integer
request_date
required
The date the user has requested verification, in Epoch format
Example : "2022-05-19 19:50:10.936008"
string
status
required
Status of the request. Status is 0 when a request is created, 1 if the request is accepted and -1 if the request is rejected
Example : "Rejected"
string
user_id
required
ID of the user requested verification
Example : 4
integer
year
required
In what year the historical event happened?
Example : 630
integer

Endpoint to get a definition of a word from wikipedia

POST /api/wikipedia_definition

Parameters

Type Name Description Schema
Body word
required
Word to be searched on wikipedia string

Responses

HTTP Code Description Schema
200 Got a definition from wikipedia successfully Response 200
400 Did not send any words. No Content

Response 200

Name Description Schema
definition
required
Definition of the word in query.
Example : "Pizza (Italian: [ˈpittsa], Neapolitan: [ˈpittsə]) is a dish of Italian origin consisting of a usually round, flat base of leavened wheat-based dough topped with ..."
string

Security

BearerAuth

Type : apiKey
Name : Authorization
In : HEADER

⚠️ **GitHub.com Fallback** ⚠️