Class UsersController

java.lang.Object
com.fredriksonsound.iot_backoffice_auth.endpoint.UsersController

@RestController
public class UsersController
extends java.lang.Object
Users API
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  UsersController.UpdateUser  
  • Constructor Summary

    Constructors 
    Constructor Description
    UsersController()  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.http.ResponseEntity<com.google.gson.JsonObject> getUSer​(java.lang.String authToken, java.lang.String userEmail)
    Gets user info of a user by email, if the user is allowed

    API doc:
    Description: Gets user info of a user by email, if the user is allowed
    Method: GET
    Location: /users/[USER_EMAIL]
    Headers:
    Auth-Token: [token]

    Success response: {status: "success", user: {..USER_DATA}}, CODE: 200
    Error response: {status: "error", message: [error_message]}, 400 or 401
    org.springframework.http.ResponseEntity<com.google.gson.JsonObject> updateUser​(UsersController.UpdateUser updateUser, java.lang.String userEmail)
    Updates a user, if the username and email is avaliable, and oldPassword matches the users old password

    API doc:
    Description: Updates a user, if the username and email is avaliable, and oldPassword matches the users old password
    Method: PUT
    Location: /users/[USER_EMAIL]
    Body:
    {
    username: [new_username],
    email: [new_email],
    password: [new_password],
    oldPassword: [old_password],
    agency: [new__agency]
    }
    Success response: {status: "success", message: "user_updated"}, CODE: 200
    Error response: {status: "error", message: [error_message]}, 400 or 401

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getUSer

      @CrossOrigin(origins="*", allowedHeaders="*") @RequestMapping(value="/users/{userEmail}", method=GET) public org.springframework.http.ResponseEntity<com.google.gson.JsonObject> getUSer​(@RequestHeader(value="Auth-Token",required=false) java.lang.String authToken, @PathVariable("userEmail") java.lang.String userEmail)
      Gets user info of a user by email, if the user is allowed

      API doc:
      Description: Gets user info of a user by email, if the user is allowed
      Method: GET
      Location: /users/[USER_EMAIL]
      Headers:
      Auth-Token: [token]

      Success response: {status: "success", user: {..USER_DATA}}, CODE: 200
      Error response: {status: "error", message: [error_message]}, 400 or 401
      Parameters:
      authToken - the auth-token to authenticate the request
      userEmail - the email of the user to get
      Returns:
      a json representing the user
    • updateUser

      @CrossOrigin(origins="*", allowedHeaders="*") @RequestMapping(value="/users/{userEmail}", method=PUT) @Transactional(isolation=SERIALIZABLE) public org.springframework.http.ResponseEntity<com.google.gson.JsonObject> updateUser​(@RequestBody UsersController.UpdateUser updateUser, @PathVariable("userEmail") java.lang.String userEmail)
      Updates a user, if the username and email is avaliable, and oldPassword matches the users old password

      API doc:
      Description: Updates a user, if the username and email is avaliable, and oldPassword matches the users old password
      Method: PUT
      Location: /users/[USER_EMAIL]
      Body:
      {
      username: [new_username],
      email: [new_email],
      password: [new_password],
      oldPassword: [old_password],
      agency: [new__agency]
      }
      Success response: {status: "success", message: "user_updated"}, CODE: 200
      Error response: {status: "error", message: [error_message]}, 400 or 401
      Parameters:
      userEmail - the user email address
      updateUser - Json body of the new user, including the old password
      Returns:
      a json representing the user