Moderator - YoussefMRefaat/timezone GitHub Wiki

Only moderators can access these points

Show all admins

  • URL

/api/moderator/admins

  • Method

GET

  • URL Params

None

  • Data Params

None

  • Success response

Code: 200 Content: {"Message":"Admins have been retrieved successfully","Data":[{"id": :id,"first_name": :name,"last_name": :name,"email": :email } , {"id": :id,"first_name": :name,"last_name": :name,"email": :email} ...]}

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 403 Content: { "Message" => "Unauthorized" } OR Code: 403 Content: { "Message" => "Email is not verified" }



Show an admin

  • URL

/api/moderator/admins/:id

  • Method

GET

  • URL Params

Required:

id=[integer]

  • Data Params

None

  • Success response

Code: 200 Content: {"Message":"Admin has been retrieved successfully", "Data":{ "id": :id, "first_name": :name, "last_name": :name,"email": :email, "email_verified_at": :date, "gender": :gender, "primary_phone": :phone, "sec_phone": :phone, "primary_address": :address , "sec_address": :address, "role":"admin", "created_at": :date, "updated_at": :date}}

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 403 Content: { "Message" => "Unauthorized" } OR Code: 403 Content: { "Message" => "Email is not verified" } OR Code: 404 Content: { "Message" => "Admin not found" }



Create an admin

  • URL

/api/moderator/admins

  • Method

POST

  • URL Params

None

  • Data Params

Required:

first_name=[string,max:15] last_name=[string,max:15] email=[email,unique] password=[string,min:6] must contain at least one number and one letter password_confirmation=[password] gender=["male" or "female"] primary_phone=[string,max:20] sec_phone=[string,max:20] primary_address=[string,max:100] sec_address=[string,max:100]

  • Success response

Code: 201 Content: { "Message" => "Admin has been created successfully"}

  • Error response

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



Delete an admin

  • URL

/api/moderator/admins/:id

  • Method

DELETE

  • URL Params

Required:

id=[integer]

  • Data Params

None

  • Success response

Code: 200 Content: {"Message":"Admin has been deleted successfully"}

  • Error response

Code: 401 Content: { "Message" => "Unauthenticated" } OR Code: 403 Content: { "Message" => "Unauthorized" } OR Code: 403 Content: { "Message" => "Email is not verified" } OR Code: 404 Content: { "Message" => "Admin not found" }