User Management
Number of APIs: 7
π€ Get started here
This collection demonstrates how to structure a user management REST API that contains endpoints for user registration, login, profile management, and more.
Users created using this API can perform tasks like registering, logging in, and updating their profiles. Users who are assigned an 'admin' role can perform all tasks, including getting a list of all users and deleting user profiles.
π Authentication and authorization
You must have a valid bearer token to use the API added in this template. When you send the Register
request, you will receive a token in the response. The Register
request also contains a test script that sets the token in the accessToken
collection variable so you can reuse it in other requests easily.
To send the requests in the Admin
folder, you need to have admin permissions. You can grant yourself admin permissions using the Register
request by adding a key named role
with admin
as the value in the request body.
π How to use this collection?
Step 1: Send the requests
Check out the different parts of the requests, including the request body, documentation, headers, tests, and URL parameters. Send the requests to view the response returned by the API.
Hereβs the order of requests in which you can explore this API to understand it better without running into any hiccups:
Register β Log in β Get profile β Update profile β Change user role β Get all users β Delete user
Step 2: Customize the requests
Add your APIβs base URL in the url
collection variable. Update the request body wherever needed and send the requests to test your API.
Step 3: Continue building the collection
Create requests in this collection to test the new API endpoints you develop.
βΉοΈ Resources
[Creating a REST API with Node.js and Express]
GitHub repo for the Node.js tutorial
[Building requests]
[Authorizing requests]
[Using variables]
[Creating your first collection]
-
Authentication - Register POST {{url}}/signup
-
Authentication - Log in POST {{url}}/login
-
User - Get profile GET {{url}}/user
-
User - Update profile PATCH {{url}}/user
-
Admin - Change user role PATCH {{url}}/user/change-role/:userId
-
Admin - Delete user DELETE {{url}}/user/:userId
-
Admin - Get all users GET {{url}}/user/all