Account - YoussefMRefaat/timezone GitHub Wiki

Only authenticated accounts can access these points

Verify email

  • URL

/api/verify-email

  • Method

POST

  • URL Params

None

  • Data Params

Required:

token=[string]

  • Success response

Code: 200 Content: { "Message" => "The email is verified successfully", }

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 401 Content: { "Message" => "Invalid or expired token" } OR Code: 422 Content: { "Message" => "The given data was invalid", "errors": { 'code' : [:messages ] } }



Resend Verification Code

  • URL

/api/verify-email/resend

  • Method

POST

  • URL Params

None

  • Data Params

None

  • Success response

Code: 201 Content: { "Message" => "Verification code has been sent to the user's email. It will expire after :x seconds" }

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 409 Content: { "Message" => "Email is already verified" } OR Code: 502 Content: { "Message" => "Failed to send the code" }



Logout

  • URL

/api/logout

  • Method

DELETE

  • URL Params

None

  • Data Params

None

  • Success response

Code: 200 Content: { "Message" => "Logged out successfully" }

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" }



Get user's information

  • URL

/api/user

  • Method

GET

  • URL Params

None

  • Data Params

None

  • Success response

Code: 200 Content: {"Message":"User has been retrieved successfully","Data":{"id": :id,"first_name": :name,"last_name": :name,"email": :email,"gender": :gender } }

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" }



Update user's information

  • URL

/api/user

  • Method

PATCH

  • URL Params

None

  • Data Params

Required:

first_name=[string,max:15] last_name=[string,max:15] email=[email,unique] gender=["male" or "female"] primary_phone=[string,max:20] primary_address=[string,max:100]

Optional:

sec_phone=[string,max:20] sec_address=[string,max:100]

  • Success response

Code: 200 Content: {"Message":"User has been updated successfully"}

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 422 Content: { "Message" => "The given data was invalid", "errors": { :field : [:messages ], :field : [:messages ] ...} }



Update user's password

  • URL

/api/user/password

  • Method

PATCH

  • URL Params

None

  • Data Params

password=[string] new_password=[string,min:6] must contain at least one number and one letter new_password_confirmation=[password]

  • Success response

Code: 200 Content: {"Message":"Password has been updated successfully"}

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 422 Content: { "Message" => "The given data was invalid", "errors": { :field : [:messages ], :field : [:messages ] ...} }