Updates existing note in database and returns updated node. Note that the update can only be in the title, text and tags fields.
URL : /api/v1/notes/{noteId}
Method : PUT
Description: ID of note to be updated. Should be a valid mongoDB objectID, i.e. hexadecimal string.
Parameter Type: Path Variable
Data Type: String
Description: Updated note to be saved. Note that the id and createdDate attributes since they will not be modified.
Parameter Type: RequestBody
Data Type: WebNote
Data Constraint: title and text attributes cannot be blank.
PUT /api/v1/notes/67524c7a06bbdc38dacf50d6
{
"title": "Updated title",
"text": "Hello this is an updated note",
"tags": ["IMPORTANT", "PERSONAL"]
}
Code : 200 OK
Content example
{
"id": "67524c7a06bbdc38dacf50d6",
"title": "Updated title",
"createdDate": "2024-12-06",
"text": "Hello this is an updated note",
"tags": [
"IMPORTANT",
"PERSONAL"
]
}
Condition : If noteId does not match any notes in database
Code : 404 NOT FOUND
Content :
{
"description": "Note not found",
"details": [
"No note matching id 67524c7a06bbdc38dacf50d7"
]
}
Condition : If either note.text or note.title is blank.
Code : 400 BAD REQUEST
Content :
{
"description": "Validation Failed",
"details": [
"Title must not be blank."
]
}
Condition : If noteId is not a valid ObjectId.
Code : 400 BAD REQUEST
Content :
{
"description": "Validation Failed",
"details": [
"Invalid ObjectId"
]
}