July 2017
Intermediate to advanced
374 pages
8h
English
This API deletes a specific user from the users list.
In this case, we will modify the del_user(del_user) method to delete a user from the MongoDB users collection as follows:
def del_user(del_user):
db = connection.cloud_native.users
api_list = []
for i in db.find({'username':del_user}):
api_list.append(str(i))
if api_list == []:
abort(404)
else:
db.remove({"username":del_user})
return "Success"
Let's test it out over POSTMAN and see if the response is as expected:

Now that we've deleted one user, let's see if it made any changes in the overall users list:
Great! We have made changes in all the RESTful API URLs for ...