Skip to content

Latest commit

 

History

History
350 lines (261 loc) · 4.74 KB

userApi.md

File metadata and controls

350 lines (261 loc) · 4.74 KB

Get Current User

URL : /api/user Method : GET Auth required : YES

Header constraints

{
  "Authorization": "Bearer __JWT__"
}
Success Response

Code : 200 OK

Content examples

{
  "id": 1,
  "name": "mmuster",
  "email": "[email protected]",
  "balance": 1000000,
  "created_at": "2021-12-06T13:12:10.000000Z",
  "updated_at": "2021-12-06T13:12:10.000000Z"
}

Create User

URL: /api/user Method: POST Auth required: No

Data constraints

{
  "name": "mmuster",
  "email": "[email protected]",
  "password": "start_01",
  "password_confirmation": "start_01"
}
Success Response

Code : 200 OK

Content examples

{
  "message": "User successfully registered",
  "user": {
    "id": 3,
    "name": "mmuster",
    "email": "[email protected]",
    "balance": "1000000",
    "created_at": "2021-12-06T13:29:05.000000Z",
    "updated_at": "2021-12-06T13:29:05.000000Z"
  }
}

Update Currentuser

URL : /api/user Method : PUT Auth required : YES

Header constraints

{
  "Authorization": "Bearer __JWT__"
}

Data constraints

{
  "name": "mmuster",
  "email": "[email protected]",
  "x_axis": 1,
  "y_axis": 0
}
Success Response

Code : 200 OK

Content examples

{
  "message": "User changed successfully.",
  "user": {
    "id": 1,
    "name": "mmuster",
    "email": "[email protected]",
    "balance": 1000000,
    "created_at": "2021-12-06T13:12:10.000000Z",
    "updated_at": "2021-12-06T13:39:38.000000Z"
  }
}

OR Validation Error

{
  "name": [
    "The name has already been taken."
  ],
  "email": [
    "The email has already been taken."
  ]
  ...
  ...
  ...
}

DELETE Current User

URL : /api/user Method : DELETE Auth required : YES

Header constraints

{
  "Authorization": "Bearer __JWT__"
}
Success Response

Code : 200 OK

Content examples

{
  "message": "User successfully deleted"
}

RESET Current User

URL : /api/user/resetAll Method : POST Auth required : YES

Es wird die Balance des Users auf den Startwert zurückgesetzt, alle Transaktionen und Favoriten des Users werden gelöscht.

Header constraints

{
  "Authorization": "Bearer __JWT__"
}
Success Response

Code : 200 OK

Content examples

{
  "message": "User reseted successfully"
}

Reset Password

wird automatisch zurückgesetzt und das neue Password an die genannte Emailadresse gesendet

URL : /api/user/password/reset Method : POST Auth required : NO

Data constraints

{
  "email": "[email protected]"
}
Success Response

Code : 200 OK

Content examples

{
  "message": "Password reseted successfully"
}

Update Currentuser Password

URL : /api/user/password Method : PUT Auth required : YES

Header constraints

{
  "Authorization": "Bearer __JWT__"
}

Data constraints

{
  "password": "start_01",
  "new_password": "start_02",
  "new_password_confirmation": "start_02"
}
Success Response

Code : 200 OK

Content examples

{
  "message": "Password changed successfully."
}

OR Validation Error

{
  "field_name": [
    "The given password doesn't match with old password."
  ],
  "password": [
    "The password field is required."
  ],
  "password": [
    "The given password doesn't match with old password."
  ],
  "new_password": [
    "The new password field is required."
  ],
  "new_password": [
    "The new password must be at least 6 characters."
  ],
  "new_password": [
    "The new password confirmation does not match."
  ]
  ...
  ...
  ...
}

Get All Symbols with Favorite Flag of User

Der Parameter favorite lässt eine Einschränkung über den Key is_favorite des Objekts durchführen Ohne den Parameter favorite wird eine 100% Liste zurückgegeben sowohl is_favorite = true und false ist enthalten.

URL : /api/user/favorites?favorite=1 Method : GET Auth required : YES

Header constraints

{
  "Authorization": "Bearer __JWT__"
}

Data constraints

{
  "favorite": "0 OR 1 OR WITHOUT"
}
Success Response

Code : 200 OK

Content examples

[
  {
    "id": 1,
    "name": "Bitcoin",
    "symbol": "BTCUSDT",
    "is_favorite": true
  },
  {
    "id": 2,
    "name": "Ethereum",
    "symbol": "ETHUSDT",
    "is_favorite": false
  },
  {
    "id": 3,
    "name": "Binance Coin",
    "symbol": "BNBUSDT",
    "is_favorite": false
  }
]