{"openapi":"3.0.0","info":{"title":"10Four","description":"10Four Breakdown Platform Backend API","termsOfService":"https://10four.co.za/terms-of-service","contact":{"name":"Rene Nochebuena","url":"https://oomphtelecoms.com","email":"rene@oomphtelecoms.com"},"license":{"name":"10Four License","url":"https://10four.co.za/license"},"version":"1.0.0"},"servers":[{"url":"http://localhost:9090/api/v1","description":"Local development server"},{"url":"http://apidev.10four.co.za/api/v1","description":"Development server"},{"url":"http://apiuat.10four.co.za/api/v1","description":"UAT server"},{"url":"http://api.10four.co.za/api/v1","description":"Production server"}],"tags":[{"name":"Authentication","description":"Authentication service"},{"name":"Users","description":"User resources"}],"paths":{"/auth/login":{"post":{"tags":["Authentication"],"summary":"Get user token after login","operationId":"login","parameters":[{"name":"X-Request-Id","in":"header","description":"The ID of the request","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Combination of user and password","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"},"examples":{"json":{"$ref":"#/components/examples/LoginRequest"}}}},"required":true},"responses":{"200":{"description":"Ok - Correct user login","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/LoginOkResponse"}}}}},"400":{"description":"Malformed request - Missing attributes or validation errors","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/BadRequest"}}}}},"401":{"description":"Unauthrorized - Failed user login","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/LoginFailResponse"}}}}}}}},"/auth/refresh":{"get":{"tags":["Authentication"],"summary":"Refresh user token","operationId":"refreshToken","parameters":[{"name":"X-Request-Id","in":"header","description":"The ID of the request","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Ok - User refresh token","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/LoginOkResponse"}}}}},"400":{"description":"Bad request - User send any type of body request"},"401":{"description":"Unauthorized - Missing JWT Token"}},"security":[{"jtw":[]}]}},"/auth/{email}/passwordrecovery":{"get":{"tags":["Authentication"],"summary":"Reset and send a temporal password to the user","operationId":"resetPassword","parameters":[{"name":"X-Request-Id","in":"header","description":"The ID of the request","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"email","in":"path","description":"Email of the user","required":true,"schema":{"type":"string","format":"email"}}],"responses":{"200":{"description":"Ok - A confirmation email is sended to the user","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/OkRequest"}}}}},"400":{"description":"Bad request - Email not found","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/BadRequest"}}}}}}}},"/users":{"post":{"tags":["Users"],"summary":"Register a new user","operationId":"createUser","parameters":[{"name":"X-Request-Id","in":"header","description":"The ID of the request","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Basic user request, if the user role is Technician the dealerId is required and also one of the following attributes, idNumber or passport","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"},"examples":{"json":{"$ref":"#/components/examples/UserRequest"}}}},"required":true},"responses":{"201":{"description":"Created - User is registered","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/UserPostResponse"}}}}},"400":{"description":"Bad request - Bad json or validation errors","content":{"application/json":{"examples":{"json":{"$ref":"#/components/examples/BadRequest"}}}}}}}}},"components":{"schemas":{"LoginRequest":{"required":["username","password"],"type":"object","properties":{"username":{"type":"string","minLength":5,"maxLength":15,"pattern":"^[A-Z]{1}[a-zA-Z#]{3,14}"},"password":{"type":"string","minLength":6,"maxLength":60,"format":"password"}}},"User":{"required":["firstName","lastName","msisdn","email","username","userRole","password"],"type":"object","properties":{"firstName":{"type":"string","minLength":3,"maxLength":30,"pattern":"[a-zA-Z]{3,30}"},"lastName":{"type":"string","minLength":3,"maxLength":30,"pattern":"[a-zA-Z]{3,30}"},"msisdn":{"type":"string","minLength":11,"maxLength":15,"pattern":"^[+]{1}[0-9]{10,14}"},"email":{"type":"string","minLength":10,"maxLength":30,"format":"email"},"username":{"type":"string","minLength":5,"maxLength":15,"pattern":"^[A-Z]{1}[a-zA-Z#]{3,14}"},"userRole":{"type":"string","enum":["Driver","Supervisor","Dealer","Technician","Administrator","Developer"]},"password":{"type":"string","minLength":6,"maxLength":30,"pattern":"[a-zA-Z#$@.-_]{6,30}"},"dealerId":{"type":"integer","format":"int64"},"idNumber":{"type":"string","minLength":10,"maxLength":20,"pattern":"[A-Z0-9]{10,20}"},"passport":{"type":"string","minimum":10,"maxLength":20,"pattern":"[A-Z0-9]{10,20}"}}}},"examples":{"OkRequest":{"description":"Example of a correct request without data","value":{"code":1000,"requestId":"bc862d20-84e1-4bcf-a999-3d141382bd00","status":"Success","title":"module.name","message":"Message description","data":null,"error":null}},"BadRequest":{"description":"Example of a bad request (Missing attributes, malformed request, etc)","value":{"code":2002,"requestId":"bd3072ab-9b8a-4ae9-9c49-fae2fa166f27","status":"Failed","title":"module.Name","message":"Error message","data":null,"error":{"description":"Error description","errorType":"Error_Type"}}},"LoginRequest":{"description":"Example of a login request","value":{"username":"John#Doe","password":"ASimplePassword"}},"LoginOkResponse":{"description":"Example of a valid user login","value":{"code":1000,"requestId":"3b826c7d-0aaf-494b-9ffb-46febed0926a","status":"Success","title":"com.oomphtelecoms.breaky.resource.AuthResource","message":"User login successfully","data":{"authToken":"JWT Data","user":{"active":true,"company":null,"createDate":"2020-12-17T16:38:03","createUserId":1,"deleted":false,"email":"john.doe@10four.co.za","firstLogin":false,"firstName":"John","lastModifyDate":"2020-12-17T16:38:03","lastModifyUserId":1,"lastName":"Doe","msisdn":"+520000000000","technician":null,"userId":1,"userRole":"Administrator","username":"John#Doe"}},"error":null}},"LoginFailResponse":{"description":"Example of a invalid user login","value":{"code":2002,"requestId":"589448e3-149d-4120-8601-df1078e6f879","status":"Failed","title":"com.oomphtelecoms.breaky.resource.AuthResource","message":"Incorrect username or password","data":null,"error":{"description":"Incorrect username or password","errorType":"Validation_Error"}}},"UserRequest":{"description":"Example of a valid user request","value":{"email":"john.doe@domain.com","firstName":"John","lastName":"Doe","msisdn":"+520000000000","userRole":"Driver","username":"John#Doe","password":"MyP@assw0rd"}},"UserPostResponse":{"description":"Example of a valid user registration","value":{"code":1000,"requestId":"a2770477-7ec9-4b45-8f7b-945cda83cad1","status":"Success","title":"com.oomphtelecoms.breaky.resource.UserResource","message":"User registered successfully","data":{"active":true,"company":null,"createDate":"2020-12-22T12:47:27.434538","createUserId":2,"deleted":false,"email":"john.doe@domain.com","firstLogin":false,"firstName":"John","lastModifyDate":"2020-12-22T12:47:27.434538","lastModifyUserId":2,"lastName":"Doe","msisdn":"+521234567890","technician":null,"userId":2,"userRole":"Dealer","username":"John#Doe"},"error":null}}},"securitySchemes":{"jtw":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}}}