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

FindNUS Backend API as of Milestone 3

Foreword

This is a copy of the backend api that is being actively refered to by the team to . A human-friendly markdown document was generated from an OpenAPI yaml specs document using OpenAPI-3 Generator.

API documentation for FindNUS backend services. Handles the retrieval, processing and management of Lost Items found in NUS. Comes with additional spicy features like NLP and elasticsearch.

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

Paths

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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag IS REQUIRED.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}
▶ 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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag should only exist for Lost items.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}

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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag should only exist for Lost items.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}

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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag IS REQUIRED.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}
▶ 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
▷ startdate

String representation of the start date to filter by. Date should be in ISO format: YYYY-MM-DDThh:mm:ssZ, eg: 2012:12:25T17:33:59Z

NameTypeInDescriptionAccepted values
startdatestringquery

String representation of the start date to filter by. Date should be in ISO format: YYYY-MM-DDThh:mm:ssZ, eg: 2012:12:25T17:33:59Z

Any
▷ enddate

String representation of the end date to filter by. Date should be in ISO format: YYYY-MM-DDThh:mm:ssZ, eg: 2012:12:25T17:33:59Z

NameTypeInDescriptionAccepted values
enddatestringquery

String representation of the end date to filter by. Date should be in ISO format: YYYY-MM-DDThh:mm:ssZ, eg: 2012:12:25T17:33:59Z

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
Response.Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
    "Pluscode": "7QXC+CR Singapore"
  }
]
▶ 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
Response.Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
    "Pluscode": "7QXC+CR Singapore"
  }
]
▶ 500 - Internal server error. Likely to be a message queue fault.
Headers

No headers specified

GET /lookout

Get a list of found items that FindNUS decides are a good possible match to the lost item queried.

▷ Id

Id of the lost item

NameTypeInDescriptionAccepted values
IdintegerqueryId of the lost itemAny
▷ User_id

User_id of the lost item’s owner

NameTypeInDescriptionAccepted values
User_idintegerqueryUser_id of the lost item's ownerAny

Responses

▶ 200 - Returns an array of found items that best match the lost item.
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
Response.Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
    "Pluscode": "7QXC+CR Singapore"
  }
]
▶ 400 - Bad request. Missing one or both of User_id and id.
Headers

No headers specified

▶ 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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag IS REQUIRED.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}
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
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
  "Pluscode": "7QXC+CR Singapore"
}
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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag should only exist for Lost items.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}
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
Lookoutboolean

Flag determining whether the Lost item has subscribed to the Lookout service. This flag should only exist for Lost items.

Any
Pluscodestring

Pluscode is a string representing the geolocation of a place based on its latitude and longitude. Optional parameter if the lost item is tagged to a particular LAT/LONG

Any
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",
  "Lookout": false,
  "Pluscode": "7QXC+CR Singapore"
}
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"