FindNUS Documentation
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Actual FindNUS API for Milestone 2

From this line below, it is the Markdown API documentation that is stored on the working backend repository for developers to reference and use.

FindNUS_api

API documentation for FindNUS backend services. Handles the retrieval, processing and management of Lost Items found in NUS.

Table of Contents

## Servers
URLDescription
https://findnus.herokuapp.comProduction cluster that is hosting the backend services for FindNUS
https://uat-findnus.herokuapp.comUser-Acceptance Testing cluster environment for testing

GET /debug/ping

Returns a Hello World equivalent message. Shows that the backend connection works.

▶ 200 - A hello world message.
Headers

No headers specified

text/plain
NameTypeDescriptionAccepted values
ResponsestringAny
Example
message: Hi there, you have reached FindNUS!

GET /debug/checkAuth

Check with backend if the Firebase token is valid.

▷ Authorization

Firebase ID token of user

NameTypeInDescriptionAccepted values
Authorization (required)stringheaderFirebase ID token of userAny
Example
"Authorization: my-firebase-idToken"

Responses

▶ 200 - Id token is valid
Headers

No headers specified

▶ 401 - Id token is invalid
Headers

No headers specified

GET /debug/getDemoItem

Get a demo item for Milestone 1.

▷ name

Name of the demoset item to be retrieved

NameTypeInDescriptionAccepted values
name (required)stringqueryName of the demoset item to be retrievedAny

Responses

▶ 200 - Get request is valid, item is found
Headers

No headers specified

application/json
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Name (required)stringName of lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_urlstringItem's accompanying image linkAny
User_idstringUserID associated to this item. Only applicable for Lookout Items.Any
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_url": "https://imgur.com/gallery/RaHyECD",
  "User_id": "string"
}
▶ 404 - Get request is valid, item not found
Headers

No headers specified

text/plain
NameTypeDescriptionAccepted values
ResponsestringAny
Example
Nothing Found!

POST /item

Add new Lost item to be put on Lookout on the database.

▷ Authorization

Firebase ID token of user

NameTypeInDescriptionAccepted values
Authorization (required)stringheaderFirebase ID token of userAny
Example
"Authorization: my-firebase-idToken"

Request body

application/json
NameTypeDescriptionAccepted values
User_idstringUnique User_id generated by firebase to associate a user to a Lookout item.Any
Name (required)stringName of new lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_base64stringAccompanying image of new Lost/Found item, if applicableAny
Example (generated)
{
  "User_id": "string",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_base64": "string"
}

Responses

▶ 200 - Item registered into database
Headers

No headers specified

▶ 400 - Rejected new item into database
Headers

No headers specified

▶ 401 - Firebase credentials not invalid
Headers

No headers specified

PATCH /item

Update details of an item on the database.

▷ Authorization

Firebase ID token of user

NameTypeInDescriptionAccepted values
Authorization (required)stringheaderFirebase ID token of userAny
Example
"Authorization: my-firebase-idToken"

Query parameters

▷ Id

MongoDB ID of the Item

NameTypeInDescriptionAccepted values
Id (required)stringqueryMongoDB ID of the ItemAny
Example
"Id=629cc52563533a84f60c4c68"
▷ User_id

FindNUS User Id (for lost item lookout requests). Include this to remove from Lost (Lookout) Items collection.

NameTypeInDescriptionAccepted values
User_id (required)stringquery

FindNUS User Id (for lost item lookout requests). Include this to remove from Lost (Lookout) Items collection.

Any
Example
"User_id=196afas7"

Request body

application/json
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
User_idstringUnique User_id generated by firebase to associate a user to a Lookout item.Any
NamestringName of new lost/found itemAny
DatestringDate-time where item is lost/foundAny
LocationstringWhere the item was foundAny
CategorystringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_base64stringUpdated image of Lost/Found item, if applicableAny
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "User_id": "string",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_base64": "string"
}

Responses

▶ 200 - OK
Headers

No headers specified

▶ 401 - Firebase credentials not invalid
Headers

No headers specified

GET /item

Get a particular item’s full details

▷ Id

Item Id reference. Case sensitive.

NameTypeInDescriptionAccepted values
Id (required)stringqueryItem Id reference. Case sensitive.Any
▷ User_id

User_id filter to search for this Id in the LOST collection. Case sensitive.

NameTypeInDescriptionAccepted values
User_idstringqueryUser_id filter to search for this Id in the LOST collection. Case sensitive.Any

Responses

▶ 200 - A Lost Item’s details
Headers

No headers specified

application/json
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Name (required)stringName of lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_urlstringItem's accompanying image linkAny
User_idstringUserID associated to this item. Only applicable for Lookout Items.Any
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_url": "https://imgur.com/gallery/RaHyECD",
  "User_id": "string"
}
▶ 404 - Item not found
Headers

No headers specified

▶ 500 - Internal server error. Likely to be a message queue fault.
Headers

No headers specified

DELETE /item

Remove an item listing on the database.

▷ Authorization

Firebase ID token of user

NameTypeInDescriptionAccepted values
Authorization (required)stringheaderFirebase ID token of userAny
Example
"Authorization: my-firebase-idToken"

Query parameters

▷ Id

MongoDB ID of the Item

NameTypeInDescriptionAccepted values
Id (required)stringqueryMongoDB ID of the ItemAny
Example
"Id=629cc52563533a84f60c4c68"
▷ User_id

FindNUS User_Id (for lost item lookout requests). Include this to remove from Lost (Lookout) Items collection. Case sensitive.

NameTypeInDescriptionAccepted values
User_idstringquery

FindNUS User_Id (for lost item lookout requests). Include this to remove from Lost (Lookout) Items collection. Case sensitive.

Any
Example
"User_id=196afas7"

Request body

application/json
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Example (generated)
{
  "Id": "98721yrr0u14oure"
}

Responses

▶ 200 - Deletion request received and will be processed if the item exists.
Headers

No headers specified

▶ 401 - Firebase credentials not invalid
Headers

No headers specified

GET /item/peek

Get a list of lost items sorted by date. These items are paginated and filtered by category, if requested. The default returns the latest 20 items, with no category filter.

▷ offset

Number of items to skip (Case sensitive)

NameTypeInDescriptionAccepted values
offsetintegerqueryNumber of items to skip (Case sensitive)Any
▷ limit

Number of items to return (Case sensitive)

NameTypeInDescriptionAccepted values
limitintegerqueryNumber of items to return (Case sensitive)Any
▷ category

Types of category to filter by. Chain multiple category values to filter by the For example, category=Cards&category=Etc will include results from both Cards and Etc.

NameTypeInDescriptionAccepted values
categorystringquery

Types of category to filter by. Chain multiple category values to filter by the For example, category=Cards&category=Etc will include results from both Cards and Etc.

Any

Responses

▶ 200 - Returns an array of lost items that may be filtered
Headers

No headers specified

application/json
NameTypeDescriptionAccepted values
Responsearray(object)Any
Response.Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Response.Name (required)stringName of lost/found itemAny
Response.Date (required)stringDate-time where item is lost/foundAny
Response.Location (required)stringWhere the item was foundAny
Response.Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Response.Image_urlstringItem's accompanying image linkAny
Example (generated)
[
  {
    "Id": "98721yrr0u14oure",
    "Name": "Water Bottle",
    "Date": "2019-08-24T14:15:22Z",
    "Location": "E4A DSA Lab",
    "Category": "Cards",
    "Image_url": "https://imgur.com/gallery/RaHyECD"
  }
]
▶ 500 - Internal server error. Likely to be a message queue fault.
Headers

No headers specified

Text-based search for an item.

▷ query

Text query to search for lost items. Can be any arbitrary string - the ElasticSearch engine will attempt to best-match the query. The query will be performed over the FOUND collection’s Name, Category, Location and Item Detail fields.

NameTypeInDescriptionAccepted values
querystringquery

Text query to search for lost items. Can be any arbitrary string - the ElasticSearch engine will attempt to best-match the query. The query will be performed over the FOUND collection's Name, Category, Location and Item Detail fields.

Any

Responses

▶ 200 - Returns an array of Found items that were matched to the query string.
Headers

No headers specified

application/json
NameTypeDescriptionAccepted values
Responsearray(object)Any
Response.Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Response.Name (required)stringName of lost/found itemAny
Response.Date (required)stringDate-time where item is lost/foundAny
Response.Location (required)stringWhere the item was foundAny
Response.Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Response.Image_urlstringItem's accompanying image linkAny
Example (generated)
[
  {
    "Id": "98721yrr0u14oure",
    "Name": "Water Bottle",
    "Date": "2019-08-24T14:15:22Z",
    "Location": "E4A DSA Lab",
    "Category": "Cards",
    "Image_url": "https://imgur.com/gallery/RaHyECD"
  }
]
▶ 500 - Internal server error. Likely to be a message queue fault.
Headers

No headers specified

Schemas

NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Name (required)stringName of lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_urlstringItem's accompanying image linkAny
User_idstringUserID associated to this item. Only applicable for Lookout Items.Any
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_url": "https://imgur.com/gallery/RaHyECD",
  "User_id": "string"
}
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Name (required)stringName of lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Image_urlstringItem's accompanying image linkAny
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Image_url": "https://imgur.com/gallery/RaHyECD"
}
NameTypeDescriptionAccepted values
User_idstringUnique User_id generated by firebase to associate a user to a Lookout item.Any
Name (required)stringName of new lost/found itemAny
Date (required)stringDate-time where item is lost/foundAny
Location (required)stringWhere the item was foundAny
Category (required)stringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_base64stringAccompanying image of new Lost/Found item, if applicableAny
Example (generated)
{
  "User_id": "string",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_base64": "string"
}
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
Example (generated)
{
  "Id": "98721yrr0u14oure"
}
NameTypeDescriptionAccepted values
Id (required)stringThe MongoDB ObjectID associated to this ItemAny
User_idstringUnique User_id generated by firebase to associate a user to a Lookout item.Any
NamestringName of new lost/found itemAny
DatestringDate-time where item is lost/foundAny
LocationstringWhere the item was foundAny
CategorystringType of itemEtc, Cards, Notes, Electronics, Bottles
Contact_methodstringFounder/Lostee Contact Methodnus_security, telegram, whatsapp, wechat, line, phone_number
Contact_detailsstringContact details of Founder/LosteeAny
Item_detailsstringAny
Image_base64stringUpdated image of Lost/Found item, if applicableAny
Example (generated)
{
  "Id": "98721yrr0u14oure",
  "User_id": "string",
  "Name": "Water Bottle",
  "Date": "2019-08-24T14:15:22Z",
  "Location": "E4A DSA Lab",
  "Category": "Cards",
  "Contact_method": "Telegram",
  "Contact_details": "FindNUS",
  "Item_details": "Blue, with a sticker and broken handle",
  "Image_base64": "string"
}
NameTypeDescriptionAccepted values
CategorystringNon-case sensitive category nameEtc, Cards, Notes, Electronics, Bottles
Example (generated)
"Etc"
NameTypeDescriptionAccepted values
ContactMethodstringNon-case sensitive contact methodnus_security, telegram, whatsapp, wechat, line, phone_number
Example (generated)
"nus_security"