Skip to main content

Week 5

Goals for the week

Sl. No.Initial GoalsCompleted
1.Finish the implementation of REST API for modifying user DetailsDone
2.Solve requested changes on existing PRsDone
3.Finish the implementation of REST API for token related queriesDone

REST APIs Implemented -

editUserDetails :

  • The API implementation of the /users/{id} PUT route to modify user Details is done.
  • This task included
    • Creating a new PUT route in the index.php file inside www/ui/api directory.
    • Adding a new method editUser in the UserControllerclass.
    • Trying to re-use the methods that are already used in the static UI.
    • Testing the API via any API platform like postman.

Testing the PR

  • Pull the changes from the above PR.

  • Use any API platform like postman.

  • Provide the request body as following ---- req-body-edit-user

  • You can expect a response like this res-edit-user

createRestApiToken and getTokens

  • The API implementation of the /users/tokens POST route for creating a REST API Token and /users/tokens/{type} GET route for getting all the REST API Tokens based on type active | expired is done.
  • This task included
    • Creating a new POST route in the index.php file inside www/ui/api directory for creating a REST API Token.
    • Creating a new GET route in the index.php file inside www/ui/api directory for getting all the REST API Tokens based on type active | expired.
    • Adding new methods createRestApiToken and getTokens in the UserController class.
    • Trying to re-use the methods that are already used in the static UI from the user_edit plugin.
    • Testing the API via any API platform like postman.

PR Link : feat(api): added /users/tokens POST Route and /users/tokens/{type} GET Route #2266

Testing the PR

  • Pull the changes from the above PR.

  • Use any API platform like postman.

  • Testing /api/v1/users/tokens

    • Provide the request body as following ---- req-body-create-token

    • You can expect a response like this res-create-token

  • Testing /api/v1/users/tokens/{type}

    • type = active res-active-tokens

    • type = expired res-expired-tokens

Conclusions and further plans

  • These PRs are currently in review and if any changes are requested, I'll be solving them in the coming week.
  • Other than this, I'll pick up any other API implementation based on priority as suggested by the mentors.