Endpoint to edit a note

We’ll have to edit note. We’ll use PUT method as we’ll use it to send data to server to modify existing data.

  1. Go to workspace page and select “new endpoint”.
  2. Name the endpoint as “editNotes” and url as “/notes/edit/”.
  3. We’ll use PUT method here as we want to send data and retrieve existing data.
  4. Select “save” to create your endpoint.
  5. Now we’ll use fetch One block to get the particular note to be edited.
  6. Drag and drop a “database fetch one” block and select “note” table in table name and give variable name as note.
  7. Add condition for id to fetch the note. Use dot operator to extract id from the data variable for the id field. {{data.id}}
  8. Drag and drop a database update block to update the note.
  9. Name variable as note (same as fetch one block variable) and add data to name and body field by extracting appropriate data from data variable and save the block.
  10. Drag and drop a response block and select 200 status code to send a success response and save the response block.
  11. Deploy the project

# Test it out

  1. Once the project is launched in browser, try editing the a note using edit link in note entry.
  2. Next we’ll create endpoint to edit note that we created.....

# Next steps

Now lets make an endpoint to delete notes. See Build endpoint to delete notes