{ "swagger": "2.0", "info": { "description": "SIPD Service Auth Rest API.", "title": "SIPD Service Auth", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "email": "lifelinejar@mail.com" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "paths": { "/auth/amankan-kata-sandi": { "post": { "description": "User melakukan Amankan Kata Sandi.", "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Amankan Kata Sandi", "operationId": "auth-amankan-kata-sandi", "parameters": [ { "description": "Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.ChangePasswordFormPublik" } } ], "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/auth/login": { "post": { "description": "Login to get JWT token and refresh token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "user login", "operationId": "auth-login", "parameters": [ { "description": "Login payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.LoginForm" } } ], "responses": { "200": { "description": "Login Success, jwt provided", "schema": { "$ref": "#/definitions/http_util.JSONResultLogin" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/auth/pre-login": { "post": { "description": "Login to get JWT token and refresh token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "user login", "operationId": "auth-pre-login", "parameters": [ { "description": "Pre login payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.PreLoginForm" } } ], "responses": { "200": { "description": "Success", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.PreLoginModel" } } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/auth/register": { "post": { "description": "Register user.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "user register", "operationId": "auth-register", "parameters": [ { "description": "Register payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.SignupForm" } } ], "responses": { "200": { "description": "Register Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/auth/token-refresh/{token}": { "post": { "description": "Refresh token to get new valid JWT token and refresh token", "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Refresh Token", "operationId": "auth-refresh-token", "parameters": [ { "description": "Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.RefreshTokenForm" } } ], "responses": { "200": { "description": "Refresh Token Success, new JWT token provided", "schema": { "$ref": "#/definitions/models.ResponseLogin" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/captcha/new": { "get": { "description": "generate new captcha.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Captcha" ], "summary": "generate new captcha", "responses": { "200": { "description": "Base64 image string", "schema": {} }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/captcha/reload/{id}": { "get": { "description": "reload captcha.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Captcha" ], "summary": "reload captcha", "parameters": [ { "type": "string", "description": "captcha ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Base64 image string", "schema": {} }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/captcha/validate": { "post": { "description": "validate captcha.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Captcha" ], "summary": "validate captcha", "parameters": [ { "description": "payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.ValidateCaptcha" } } ], "responses": { "200": { "description": "validate success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/site/index": { "get": { "description": "index page.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Site" ], "summary": "index", "operationId": "index", "responses": { "200": { "description": "Success", "schema": {} }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Login forbidden", "schema": { "$ref": "#/definitions/utils.LoginError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/change-password": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "change password.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "change password", "operationId": "user-change-password", "parameters": [ { "description": "Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.ChangePasswordForm" } } ], "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/generate-password-hash": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "generate password hash.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "generate password hash", "operationId": "user-generate-password-hash", "parameters": [ { "description": "Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.GenerateHashForm" } } ], "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/logout": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "user logout.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "logout", "operationId": "user-logout", "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/profile": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "get profile info.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "user get profile info", "operationId": "user-profile", "responses": { "200": { "description": "Success", "schema": { "$ref": "#/definitions/models.UserDetail" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/update-profile": { "put": { "security": [ { "ApiKeyAuth": [] } ], "description": "update profile.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "update profile", "parameters": [ { "description": "Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/form.UpdateUserProfileForm" } } ], "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } }, "/strict/user/upload-avatar": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "upload avatar", "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "upload avatar", "operationId": "user-upload avatar", "parameters": [ { "type": "file", "description": "Image avatar", "name": "file", "in": "formData", "required": true } ], "responses": { "200": { "description": "Success", "schema": { "type": "boolean" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "404": { "description": "Data not found", "schema": { "$ref": "#/definitions/utils.RequestError" } }, "422": { "description": "Data validation failed", "schema": { "type": "array", "items": { "$ref": "#/definitions/utils.RequestError" } } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/utils.RequestError" } } } } } }, "definitions": { "form.ChangePasswordForm": { "type": "object", "required": [ "new_password", "new_password_repeat", "old_password" ], "properties": { "new_password": { "description": "New password", "type": "string", "example": "123456" }, "new_password_repeat": { "description": "New password confirmation, must equal to password", "type": "string", "example": "123456" }, "old_password": { "description": "Old password", "type": "string", "example": "123456" } } }, "form.ChangePasswordFormPublik": { "type": "object", "required": [ "new_password", "new_password_repeat", "old_password", "username" ], "properties": { "new_password": { "description": "New password", "type": "string", "example": "123456" }, "new_password_repeat": { "description": "New password confirmation, must equal to password", "type": "string", "example": "123456" }, "old_password": { "description": "Old password", "type": "string", "example": "123456" }, "username": { "description": "IdDaerah int64 `json:\"id_daerah\" xml:\"id_daerah\" form:\"id_daerah\" example:\"101\" validate:\"gte=0\"` //Id daerah target user\nIdUser int64 `json:\"id_user\" xml:\"id_user\" form:\"id_user\" example:\"18\" validate:\"gte=0\"` //Id target user", "type": "string", "example": "user" } } }, "form.GenerateHashForm": { "type": "object", "required": [ "password", "password_repeat" ], "properties": { "password": { "type": "string", "example": "123456" }, "password_repeat": { "type": "string", "example": "123456" } } }, "form.LoginForm": { "type": "object", "required": [ "password" ], "properties": { "id_daerah": { "description": "Id daerah user", "type": "integer", "example": 34 }, "id_pegawai": { "type": "integer", "example": 36107 }, "password": { "description": "User password", "type": "string", "example": "1" } } }, "form.PreLoginForm": { "type": "object", "required": [ "captcha_id", "captcha_solution", "password", "username" ], "properties": { "captcha_id": { "type": "string" }, "captcha_solution": { "type": "string" }, "password": { "description": "User password", "type": "string", "example": "1" }, "tahun": { "type": "integer", "minimum": 1, "example": 2023 }, "username": { "description": "Username of user (NIP)", "type": "string", "example": "198604292011011004" } } }, "form.RefreshTokenForm": { "type": "object", "required": [ "token" ], "properties": { "token": { "description": "JWT expired token", "type": "string", "example": "xxxxx" } } }, "form.SignupForm": { "type": "object", "required": [ "id_daerah", "password", "password_repeat", "username" ], "properties": { "id_daerah": { "description": "ID Daerah", "type": "integer", "example": 251 }, "nama_bidang": { "description": "Nama Bidang", "type": "string" }, "nama_user": { "description": "Nama User (Ex: Kab Tanggamus)", "type": "string", "example": "Kab. Tanggamus" }, "nip": { "description": "NIP", "type": "string", "example": "123456789876543213" }, "password": { "description": "Password user", "type": "string", "example": "123456" }, "password_repeat": { "description": "Confirm Password user", "type": "string", "example": "123456" }, "username": { "description": "Username user", "type": "string", "example": "admlambar" } } }, "form.UpdateUserProfileForm": { "type": "object", "required": [ "id_pang_gol", "nama_user", "nik", "npwp" ], "properties": { "alamat": { "description": "Alamat", "type": "string", "example": "xxxx" }, "id_pang_gol": { "description": "ID pangkat/golongan", "type": "integer", "example": 1 }, "nama_user": { "description": "Nama User (Ex: Kab Tanggamus)", "type": "string", "example": "Kab. Tanggamus" }, "nik": { "description": "NIK", "type": "string", "example": "123456789876543213" }, "npwp": { "description": "NPWP", "type": "string", "example": "123456789876543213" }, "tgl_lahir": { "description": "Tanggal lahir", "type": "string", "example": "1945-08-17" } } }, "http_util.JSONResultLogin": { "type": "object", "properties": { "is_default_password": { "type": "boolean", "example": false }, "refresh_token": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MzYxNjgyMjksImlk._aYI7pV2c9SU9VOp3RY_mxtFenYFQuKPJtVfk" }, "token": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MzYwODU0MjksImlkIjoyLCJwaG9uZSI6Iis2MjgxMjM0NTYyIiwidXNlcm5hbWUiOi.dl_ojy9ojLnWqpW589YltLPV61TCsON-3yQ2" } } }, "models.PreLoginModel": { "type": "object", "properties": { "id_daerah": { "type": "integer" }, "id_pegawai": { "type": "integer" }, "id_role": { "type": "integer" }, "id_skpd_lama": { "type": "integer" }, "id_unik_skpd": { "type": "string" }, "id_user": { "type": "integer" }, "kode_skpd": { "type": "string" }, "nama_daerah": { "type": "string", "example": "Kota Bandar Lampung" }, "nama_role": { "type": "string" }, "nama_skpd": { "type": "string" }, "nama_user": { "type": "string", "example": "John Doe" }, "nip_user": { "type": "string", "example": "196408081992011001" } } }, "models.ResponseLogin": { "type": "object", "properties": { "refresh_token": { "description": "Jwt refresh token", "type": "string", "example": "sdfsfsfsdfsfsdfsfsdfsf" }, "token": { "description": "Jwt token", "type": "string", "example": "sdfsfsfsdfsfsdfsfsdfsf" } } }, "models.UserDetail": { "type": "object", "properties": { "alamat": { "type": "string", "example": "sddsfsd" }, "id_daerah": { "type": "integer", "example": 111 }, "id_role": { "type": "integer" }, "id_skpd_lama": { "type": "integer" }, "id_unik_skpd": { "type": "string" }, "id_user": { "type": "integer", "example": 581 }, "kode_skpd": { "type": "string" }, "nama_daerah": { "type": "string", "example": "Kota Bandar Lampung" }, "nama_skpd": { "type": "string" }, "nama_user": { "type": "string", "example": "John Doe" }, "nik_user": { "type": "string", "example": "222112323324" }, "nip_user": { "type": "string", "example": "196408081992011001" }, "npwp_user": { "type": "string", "example": "222112323324" }, "status": { "type": "string" } } }, "models.ValidateCaptcha": { "type": "object", "required": [ "id", "solution" ], "properties": { "id": { "type": "string" }, "solution": { "type": "string" } } }, "utils.DataValidationError": { "type": "object", "properties": { "field": { "type": "string", "example": "email" }, "message": { "type": "string", "example": "Invalid email address" } } }, "utils.LoginError": { "type": "object", "properties": { "attempt": { "description": "sisa kesempatan login sebelum diblokir 5 menit", "type": "integer", "example": 3 }, "message": { "description": "keterangan error", "type": "string", "example": "invalid username or password" }, "next_login": { "description": "unix timestamp UTC blokir login dibuka kembali", "type": "integer", "example": 123233213 } } }, "utils.RequestError": { "type": "object", "properties": { "code": { "type": "integer", "example": 422 }, "fields": { "type": "array", "items": { "$ref": "#/definitions/utils.DataValidationError" } }, "message": { "type": "string", "example": "Invalid email address" } } } }, "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }