Skip to content

GlobeScanner API documentation

VISHESHA SADU edited this page Apr 21, 2022 · 36 revisions

Welcome to the GlobeScanner wiki!

Backend API Documentation:

Signup

Users can register as a tourist or guide to the application with their username, email, password and role(Tourist/Guide).

Screen Shot 2022-04-20 at 6 19 36 PM

Output

Screen Shot 2022-04-20 at 7 44 13 PM

Error responses for sign up:

Condition: password length is not in between 6 to 20 characters.

{
   "error": "incorrect parameters, password should be between 6 to 20 chars"
}

Condition: The email input by the user is already registered.

{
    "error": "this Email is already taken by other user"
}

Condition: Error occurred while hashing the password or other internal errors.

{
    "error": "interval server error"
}

Login

Users have to login with their email,password and role(Tourist/Guide) to the application.

Screen Shot 2022-04-20 at 7 46 51 PM

Output

Screen Shot 2022-04-20 at 7 39 27 PM

Error responses for login:

Condition: Error in input parameters (not binding the required conditions).

{
   "error": "incorrect input parameters"

}

Condition: No user found with given login credentials

{
    "error": "user not found or role does not match"

}

Condition: Error occurred while hashing the password or other internal errors.

{
    "error": "wrong password"
}

Check user profile

Tourists and guides will both have access to see their account profile.

Screen Shot 2022-04-20 at 9 16 05 PM

Output For Guide profile

Screen Shot 2022-04-20 at 10 32 40 PM

Output for Tourist profile

Screen Shot 2022-04-20 at 10 41 20 PM

Error responses for checking user profile:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: Unknown error

{
    "error": "Internal server error."

}

Edit Tourist Profile

Tourists have access to edit details on their account profile.

Screen Shot 2022-04-20 at 11 10 42 PM

Output

Screen Shot 2022-04-20 at 11 13 58 PM

Error responses for editing tourist profile:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: If input request does not satisfy data constraints

{
    "error": "invalid input"

} 

Condition: Unknown error

{
    "error": "Internal server error."

}

Edit Guide Profile

Screen Shot 2022-04-21 at 12 34 46 AM

Output

Screen Shot 2022-04-21 at 12 35 23 AM

Error responses for editing guide profile:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: If input request does not satisfy data constraints

{
    "error": "invalid input"

} 

Condition: Unknown error

{
    "error": "Internal server error."

}

Search places:

Tourists and Tour guides can look up for the places to see in an area.

Screen Shot 2022-04-20 at 8 24 40 PM

Output

Screen Shot 2022-04-20 at 8 26 58 PM

Error responses for search places:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: When location name is invalid

{
    "error": "Please enter a valid location name."

}

Add Packages

Guides can add tour packages for any location.

Screen Shot 2022-04-20 at 8 46 58 PM

Output

Screen Shot 2022-04-20 at 8 48 09 PM

Error responses for add packages:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: When request is not made by a guide

{
    "error": "User needs to be a Guide. Please register as a Guide."

}

Condition: If input request does not satisfy data constraints

{
    "error": "incorrect parameters"

}

Condition: Unknown error

{
    "error": "Internal server error."

}

Fetch Own Packages

Guides can see all the tour packages they have added on their profile.

Screen Shot 2022-04-21 at 12 43 11 AM

Output

Screen Shot 2022-04-21 at 12 44 00 AM

Error responses for viewing added packages:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: When request is not made by a guide.

{
    "error": "User needs to be a Guide. Please register as a Guide."

}

Condition: When no packages are available for the searched location.

{
    "error": "No package currently available for this user."

}

Condition: Unknown error.

{
    "error": "Internal server error."

}

Search Packages

Tourists/Guides can view tour packages available for the place they have searched.

Screen Shot 2022-04-20 at 9 03 12 PM

Output

Screen Shot 2022-04-20 at 9 04 04 PM

Error responses for search packages:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: When location name is not valid.

{
    "error": "Please enter a valid location name."

}

Condition: When no packages are available for the searched location.

{
    "error": "No package currently available for this location."

}

Condition: Unknown error

{
    "error": "Internal server error."

}

Book Packages

Tourists can book any available tour package for a location. Based on the package selected by the tourist, the corresponding packageId will be sent in request to server.

book_packages

Error responses for book packages:

Condition: Error in authorization token (not binding the required conditions).

{
   "error": "Unauthorized"

}

Condition: When user is not a tourist.

{
   "error": "User needs to be a Tourist. Please register as a tourist."

}

Condition: Unknown error

{
    "error": "Internal server error."

}

View Bookings

Tourists can see their booked packages on their profile. Based on the email extracted from authorization token, a list of the corresponding booked packages are returned in response.

view_booking

Error responses for view bookings:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Condition: When user is not a tourist

 {
    "error": "User needs to be a Tourist."
 }

Condition: Unknown error

 {
    "error": "Error occured. Please try again."
 }

Add comments

Tourists can add reviews of any tour packages that they have booked.

Screen Shot 2022-04-21 at 1 12 58 AM

Output

Screen Shot 2022-04-21 at 1 10 59 AM

Error responses for adding comments:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Condition: When user is not a tourist

 {
    "error": "User needs to be a Tourist."
 }

Condition: Unknown error

 {
    "error": "Error occured. Please try again."
 }

Get Package Comments

Cooments for any package can be viewed by sending the packageId in request to server.

Screen Shot 2022-04-21 at 1 16 41 AM

Output

Screen Shot 2022-04-21 at 1 16 05 AM

Error responses for viewing comments:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Condition: Unknown error

 {
    "error": "Error occured. Please try again."
 }

Fetch user Comments

Tourists can fetch all the comments given by him

my_comments

Error responses for adding comments:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Condition: When user is not a tourist

 {
    "error": "User needs to be a tourist."
 }

Condition: Unknown error

 {
    "error": "Error occured. Please try again."
 }

Logout

Users can logout by giving the Acess token in the Authorization

logout

Error responses for logout:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Refresh

Users can refresh and get a new Access token and Refresh token when the Access token is expired

refresh

Error responses for refresh:

Condition: The user authentication fails

 {
    "unauthorized"
 }

Condition: When the Refresh token is expired

 {
    "error": "Refresh token expired"
 }

Condition: Unknown error

 {
    "error": "Error occured"
 }