IPTP Developer

Developer

  • Getting started
    • Docker
    • MarkDown
    • Merge
  • ESB
    • Configuration
  • XM
    • API
    • Chats
    • ERP Integration
    • Messages
    • Sync
  • IPTP ID
    • Integration
  • Ugene
    • API
    • Error codes
    • How create plugin
  • Live assistance api
    • API

API structure And Definition

1. Module Registration - Sign Up:

  • Require: Required password must include numbers, lowercase letters, uppercase letters.
  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
  • Argument:
    • uname (string): username of the user.
    • pass (string): the account’s password is used to log in.
    • email (string): It is the field of the user account that contains the email address that is used to send mail to.
  • Body:
    {
        "module": "reg",
        "param": "signup",
        "args": {
            "uname": "user01",
            "pass": "Francis1992",
            "email": "vucongthanh92@gmail.com"
        },
        "language": "en",
        "timestamp": "111111"
    }
  • Response:
    + Success:
    
        {
            "success": 1,
            "answer": {
                "message": "100100"
            },
            "timestamp": 1605516143,
            "language": "en",
            "session": {}
        }
       
    + Error: email exist
    
        {
            "success": 0,
            "error": "001402",
            "timestamp": 1605516223,
            "language": "en",
            "session": {}
        }

2. Module Registration - Resend Confirm Email:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
  • Argument:
    • email (string): the email address of the user account which is used to identify your account and is the address for email to.
  • Body:
            {
                "module": "reg",
                "param": "resend-confirm",
                "args": {
                    "email": "vucongthanh92@gmail.com"
                },
                "language": "vi",
                "timestamp": "123456789"
            }
  • Reponse:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "message": "100007"
                    },
                    "timestamp": 1605516596,
                    "language": "vi"
                }
            + Error:
                {
                    "success": 0,
                    "error": "001400",
                    "timestamp": 1605516673,
                    "language": "vi"
                }

3. Module Registration - Confirm Email:

  • Method: GET
  • URL: {{local}}/api/reg/confirm-email/en?hash=foiWt1
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100006"
            },
            "timestamp": 1605516766,
            "language": "vi"
        }
    + Error: key incorrect
        {
            "success": 0,
            "error": "001400",
            "timestamp": 1605516832,
            "language": "vi"
        }

4. Module Authentication - Sign In:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
  • Argument:
    • uname (string): username or email address of the user’s account.
    • pass (string): password of the user account.
  • Body:
             {
                "module": "auth",
                "param": "signin",
                "args": {
                    "uname": "admin",
                    "pass": "IWremVw4LH",
                    "otp": "991805"
                },
                "language": "ru",
                "timestamp": "123456789"
            }
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoieTFGcGRacUdVT2NKcXBQeGNkZ3J4SDFkeXR0aHFTcmJ3NjlWSVRRN0pwOTBEcGtnIiwiZXhwIjoxNjA1NTI0MTIzfQ.a18qznAlN1DlZwmcjE5tImvbhq8XHDJXROXozlZHD6Y"
                    },
                    "timestamp": 1605516923,
                    "language": "ru"
                }
            + Error: password incorrect
                {
                    "success": 0,
                    "error": "001404",
                    "timestamp": 1605517008,
                    "language": "ru"
                }

5. Module Authentication - Refresh Session:

  • Method: POST
  • URL: {{local}}/api
  • Header:
    + content-type: application/json
  • Argument:
    • refresh-token (string): a string of token to refresh session of user
  • Body:
            {
                "module": "auth",
                "param": "refresh-session",
                "args": {
                    "refresh-token": "Be0CZUzxeWUChLMkgG"
                },
                "language": "en",
                "timestamp": 1614053290
            }
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "access-token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZWZyZXNoX3Rva2VuIjoiQmUwQ1pVenhlV1VDaExNa2dHIiwiZXhwIjoxNjE2NzM4MTY0fQ.l3HidZPw-9OPVMb0GwevMXfYpsjgrRRKNcITmVtQ_FY",
                        "refresh_token": "Be0CZUzxeWUChLMkgG"
                    },
                    "timestamp": 1616730964,
                    "language": "en",
                    "session": {
                        "completed": 1,
                        "is_admin": 1,
                        "session_exp": 1616738164,
                        "uid": "IcKwynTrrlPi"
                    }
                }
            + Error: password incorrect
                {
                    "success": 0,
                    "error": "001416",
                    "timestamp": 1616731585,
                    "language": "en",
                    "session": {}
                }

5. Module Authentication - Restore Password:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
  • Argument:
    • uname: string - the username or email address of the user account that is used to verify your account
  • Body:
            {
                "module": "auth",
                "param": "restore-pwd",
                "args": {
                    "uname": "admin"
                },
                "timestamp": "123456789"
            }
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "message": "100003"
                    },
                    "timestamp": 1605517234,
                    "language": "ru"
                }
            + Error: Email incorrect
                {
                    "success": 0,
                    "error": "001404",
                    "timestamp": 1605517519,
                    "language": "ru"
                }

6. Module Authentication - Verify Password:

  • Method: GET
  • URL: {{local}}/api/auth/verify-pwd/en?hash=5ClEmz
  • Header:
    + content-type: application/json
  • Params:
    • hash: a random string is generated to confirm the user’s password recovery process.
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "message": "100005"
                    },
                    "timestamp": 1605517591,
                    "language": "ru"
                }
            + Error:
                {
                    "success": 0,
                    "error": "001400",
                    "timestamp": 1605517664,
                    "language": "ru"
                }

7. Module User - Profile:

  • Method: GET
  • URL: {{local}}/api/user/profile/en
  • Header
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiMjJxcEo0OGFiSHVyRmhyVXhXaVU4WmJDdVYySHpvME05d3JlUnVrbTJBdkFvQjdBIiwiZXhwIjoxNjA2Mjg2NjY0fQ.oZo3oo1qt-ok2BHFS9HAME9bYFinXjZ3gaoDE7ng9h8
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "data": {
                            "uid": "A2JYaf3BTLqp",
                            "username": "admin",
                            "email": "vucongthanh92@gmail.com",
                            "admin": true,
                            "deleted": false,
                            "mailsent": 0,
                            "mailconfirmed": 0,
                            "completed": true,
                            "restricted": false,
                            "status": true,
                            "created_at": 1614138433,
                            "updated_at": 0,
                            "logged_at": 1614140524
                        }
                    },
                    "timestamp": 1614140546,
                    "language": "en",
                    "session": {
                        "completed": 1,
                        "is_admin": 1,
                        "session_exp": 1614147746,
                        "uid": "A2JYaf3BTLqp"
                    }
                }
            + Error: Token wrong
                {
                    "success": 0,
                    "error": "004004",
                    "timestamp": 1605517867,
                    "language": "ru"
                }

8. Module User - Change Email:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiMjJxcEo0OGFiSHVyRmhyVXhXaVU4WmJDdVYySHpvME05d3JlUnVrbTJBdkFvQjdBIiwiZXhwIjoxNjA2Mjg2NjY0fQ.oZo3oo1qt-ok2BHFS9HAME9bYFinXjZ3gaoDE7ng9h8
  • Argument:
    • email (string): New email address, this value will be updated to the database.
  • Body: { “module”: “user”, “param”: “change-email”, “args”: { “email”: “vucongthanh94@gmail.com” }, “timestamp”: “123456789” }
  • Response:
            + Success:
                {
                "success": 1,
                "answer": {
                    "message": "100008"
                },
                "timestamp": 1605519353,
                "language": "ru"
            }
            + Error:
                {
                    "success": 0,
                    "error": "001402",
                    "timestamp": 1605519395,
                    "language": "ru"
                }

9. Module User - Change Password:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoieVMxUk40YnYxVU1nRmk0QzIwb215ZGM3VFFaYzZoZFd0ZEZ4d1dkS05uWFFHVURIIiwiZXhwIjoxNjA2Mjk0MDkzfQ.MsQQj6Q3L6sL78d_ERXgknOVW3SusM2-2z8w2XVYfWc
  • Argument:
    • current-pwd: string - old password of user account.
    • new-pwd: string - new password of user account.
  • Body:
            {
                "module": "user",
                "param": "change-pwd",
                "args": {
                    "current-pwd": "VdtYttuHgr",
                    "new-pwd": "Francis1992"
                },
                "language": "chi",
                "timestamp": "123456789"
            }
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "message": "100009"
                    },
                    "timestamp": 1605519463,
                    "language": "chi"
                }
            + Error:
                {
                    "success": 0,
                    "error": "001410",
                    "timestamp": 1605519727,
                    "language": "chi"
                }

10. Module User - Logout:

  • Method: GET
  • URL: {{local}}/api/user/logout/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoieVMxUk40YnYxVU1nRmk0QzIwb215ZGM3VFFaYzZoZFd0ZEZ4d1dkS05uWFFHVURIIiwiZXhwIjoxNjA2Mjk0MDkzfQ.MsQQj6Q3L6sL78d_ERXgknOVW3SusM2-2z8w2XVYfWc
  • Response:
            + Success:
                {
                    "success": 1,
                    "answer": {
                        "message": "100011"
                    },
                    "timestamp": 1614073145,
                    "language": "en",
                    "session": {
                        "completed": 1,
                        "is_admin": 1,
                        "session_exp": 1614080345,
                        "uid": "xSMTRf5DTAur"
                    }
                }
            + Error:
                {
                    "success": 0,
                    "error": "004004",
                    "timestamp": 1614073406,
                    "language": "en",
                    "session": {}
                }

11. Module User - Logout All Session:

  • Method: GET
  • URL: {{local}}/api/user/logout/en?refresh-token=OpxoDHhyPLuPq7GDWa
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoieVMxUk40YnYxVU1nRmk0QzIwb215ZGM3VFFaYzZoZFd0ZEZ4d1dkS05uWFFHVURIIiwiZXhwIjoxNjA2Mjk0MDkzfQ.MsQQj6Q3L6sL78d_ERXgknOVW3SusM2-2z8w2XVYfWc
  • Parameter:
    • refresh-token: The token is a string which be used to refresh session and be stored in user_token table in database.
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100011"
            },
            "timestamp": 1614073145,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614080345,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "004004",
            "timestamp": 1614073406,
            "language": "en",
            "session": {}
        }

12. Module User - Delete Account:

  • Method: GET
  • URL: {{local}}/api/user/delete-account/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiMlFXUlVWVzZ0aWpuZnlwUmh5STltenVZWHlDd3RtUnVsTnFqUFF1bHJuSEY1cjFKIiwiZXhwIjoxNjA2Mjk0NDI1fQ.o3WHRTdHVd5KLm8WC_OvnHx1_bPmbyRnRf7biV9FCFo
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100010"
            },
            "timestamp": 1614075985,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614083185,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "004004",
            "timestamp": 1605519983,
            "language": "ru"
        }

13. Module User - Switch Two Factor Authentication:

  • Method: GET
  • URL: {{local}}/api/user/switch-2fa/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiN1ZjV1Z3SEtqeVdabnc3SnhyUkFpeVRvUFV1eEZ4ZWpWbFBaQ1FzM2ZlY09TdFZBIiwiZXhwIjoxNjA2Mjk0NzQ1fQ.lAVVAEwGyq5TVVtRC3BK08TJkhdU_CumepOPzP5C_Mo
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": {
                    "UID": "xSMTRf5DTAur",
                    "ConfigName": "Authentication Two Factor",
                    "ConfigGroup": "security",
                    "ConfigKey": "auth_two_factor",
                    "CurrentValue": "1",
                    "DefaultValue": "0",
                    "Status": true,
                    "CreatedAt": 1613722017,
                    "UpdatedAt": 1614076787
                }
            },
            "timestamp": 1614076788,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614083987,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "004004",
            "timestamp": 1605520094,
            "language": "ru"
        }

14. Module User - Resend One-Time (OTP):

  • Method: GET
  • URL: {{local}}/api/user/resend-otp/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiN1ZjV1Z3SEtqeVdabnc3SnhyUkFpeVRvUFV1eEZ4ZWpWbFBaQ1FzM2ZlY09TdFZBIiwiZXhwIjoxNjA2Mjk0NzQ1fQ.lAVVAEwGyq5TVVtRC3BK08TJkhdU_CumepOPzP5C_Mo
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100104"
            },
            "timestamp": 1614077495,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614084695,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "002004",
            "timestamp": 1608637320,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1608644520,
                "uid": "a8ITxJn9GiUw"
            }
        }

15. Module Admin - Show Users:

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Arguments:
    • sort (string): used to sort the data after retrieval. it has default values “asc” and “desc”.
    • filter (string): contains values to filter or search for in some fields of records such as username, email.
    • pagesize (int): number of records to be displayed per page. If it is empty then the default value is 10 records.
    • pageno (int): This parameter is used to calculate the offset of the query to get data. In addition, it shows the current page number. Default value is 1.
  • Body:
    {
        "module": "admin",
        "param": "show-users",
        "args": {
            "sort": "desc",
            "filter": "",
            "pagesize": 10,
            "pageno": "1"
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": [
                    {
                        "id": 2,
                        "uid": "iWl3YSFpJQUG",
                        "username": "user01",
                        "email": "vucongthanh94@gmail.com",
                        "is_admin": false,
                        "deleted": false,
                        "mailsent": 1605516593,
                        "mailconfirmed": 1605516766,
                        "completed": true,
                        "status": true,
                        "created_at": 1605516139,
                        "updated_at": 1605516766,
                        "logged_at": 0
                    }
                ]
            },
            "timestamp": 1605587572,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "003012",
            "timestamp": 1605587805,
            "language": "en"
        }

16. Module Admin: Add User

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • uname (string): username of the user.
    • pass (string): password of the user account.
    • email (string): email of the user account.
    • status (boolean): for the status of the account, this value represents whether the user account is active or blocked.
  • Body:
    {
        "module": "admin",
        "param": "add-user",
        "args": {
            "uname": "user04",
            "pass": "Francis@1992",
            "email": "vucongthanh97@gmail.com",
            "status": true
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100100"
            },
            "timestamp": 1603081965,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "001402",
            "timestamp": 1605587969,
            "language": "en"
        }

17. Module Admin: Users Info

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • sort (string): used to sort the data after retrieval. it has default values “asc” and “desc”.
    • filter (string): contains values to filter or search for in some fields of records such as username, email, or fullname.
    • pagesize (int): number of records to be displayed per page. If it is empty then the default value is 10 records.
    • pageno (int): This parameter is used to calculate the offset of the query to get data. In addition, it shows the current page number. Default value is 1.
  • Body:
    {
        "module": "admin",
        "param": "users-info",
        "args": {
            "sort": "desc",
            "filter": "",
            "pagesize": 10,
            "pageno": "1"
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": [
                    {
                        "uid": "682851604302834056330809",
                        "username": "user04",
                        "email": "vucongthanh93@gmail.com",
                        "admin": false,
                        "deleted": false,
                        "mailsent": 0,
                        "mailconfirmed": 0,
                        "completed": true,
                        "status": true,
                        "created_at": 1604302834,
                        "updated_at": 1604303258,
                        "logged_at": 0,
                        "creator_id": "257771604290299148659968",
                        "group_id": "",
                        "config": [
                            {
                                "uid": "190891604302834057803970",
                                "user_id": "682851604302834056330809",
                                "ConfigName": "Authentication Two Factor",
                                "ConfigGroup": "security",
                                "ConfigKey": "auth_two_factor",
                                "CurrentValue": "0",
                                "DefaultValue": "0",
                                "Status": true,
                                "CreatedAt": 1604302834,
                                "UpdatedAt": 1604302834
                            }
                        ]
                    },
                    {
                        "uid": "081561604290644094448656",
                        "username": "user03",
                        "email": "vucongthanh96@gmail.com",
                        "admin": false,
                        "deleted": false,
                        "mailsent": 1604290644,
                        "mailconfirmed": 1604290698,
                        "completed": true,
                        "status": true,
                        "created_at": 1604290644,
                        "updated_at": 1604290698,
                        "logged_at": 0,
                        "creator_id": "",
                        "group_id": "",
                        "config": [
                            {
                                "uid": "765701604290644098454169",
                                "user_id": "081561604290644094448656",
                                "ConfigName": "Authentication Two Factor",
                                "ConfigGroup": "security",
                                "ConfigKey": "auth_two_factor",
                                "CurrentValue": "0",
                                "DefaultValue": "0",
                                "Status": true,
                                "CreatedAt": 1604290644,
                                "UpdatedAt": 1604290644
                            }
                        ]
                    },
                    {
                        "uid": "933631604290582366454058",
                        "username": "user02",
                        "email": "vucongthanh95@gmail.com",
                        "admin": false,
                        "deleted": false,
                        "mailsent": 1604290582,
                        "mailconfirmed": 1604290600,
                        "completed": true,
                        "status": true,
                        "created_at": 1604290582,
                        "updated_at": 1604290600,
                        "logged_at": 0,
                        "creator_id": "",
                        "group_id": "",
                        "config": [
                            {
                                "uid": "268091604290582371290870",
                                "user_id": "933631604290582366454058",
                                "ConfigName": "Authentication Two Factor",
                                "ConfigGroup": "security",
                                "ConfigKey": "auth_two_factor",
                                "CurrentValue": "0",
                                "DefaultValue": "0",
                                "Status": true,
                                "CreatedAt": 1604290582,
                                "UpdatedAt": 1604290582
                            }
                        ]
                    }
                ]
            },
            "timestamp": 1604303515,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "003012",
            "timestamp": 1605588118,
            "language": "en"
        }

18. Module Admin: Change User Status (Block and Unblock)

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • uid (string): is the value that represents the UID field of the account.
    • status (boolean): The status of the user account, it represents the account locked or unlocked.
  • Body:
    {
        "module": "admin",
        "param": "change-user-status",
        "args": {
            "uid": "mkEANnixc3JZ",
            "status": false
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100100"
            },
            "timestamp": 1603081965,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "001409",
            "timestamp": 1605588197,
            "language": "en"
        }

19. Module Admin: Change Admin Rights Of User (Grant And Invoke)

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • uid (string): is the value that represents the UID field of the account.
    • is_admin (boolean): value representing the admin rights of the user account.
  • Body:
    {
        "module": "admin",
        "param": "change-admin",
        "args": {
            "uid": "GG5x2rS5kJCT",
            "is_admin": true
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100015"
            },
            "timestamp": 1605588436,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "003014",
            "timestamp": 1603453014,
            "language": "en"
        }

20. Module Admin: Change Registration (allow or forbid registration)

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • status (boolean): status of config registration
  • Body:
    {
        "module": "admin",
        "param": "change-registration",
        "args": {
            "status": true
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100016"
            },
            "timestamp": 1603856532,
            "language": "en"
        }
    + Error: This error appears when you are already logged out or the token is incorrect
        {
            "success": 0,
            "error": "003007",
            "timestamp": 1603857298,
            "language": "en"
        }

21. Module Admin: Switch Confirm Email (switch on / off email confirmation)

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • status (boolean): status of confirm email
  • Body:
    {
        "module": "admin",
        "param": "switch-confirm-email",
        "args": {
            "status": false
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100016"
            },
            "timestamp": 1603868553,
            "language": "en"
        }
    + Error:
        {
            "success": 0,
            "error": "003007",
            "timestamp": 1603857298,
            "language": "en"
        }

22. Module Admin: Create And Delegate Role

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • status: boolean - status of confirm email
  • Body:
    {
        "module": "admin",
        "param": "create-role",
        "args": {
            "name": "role 1",
            "permissions": [4,3,1,7,6],
            "status": false
        },
       
       "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100018"
            },
            "timestamp": 1605696564,
            "language": "en"
        }
    + Error:
        {
            "success": 0,
            "error": "001412",
            "timestamp": 1605696596,
            "language": "en"
        }

23. Module Admin: Modify Role And Delegate Admin Function To It

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • id (int): The role’s id is a unique identifier.
    • name (string): Name of the role, this is an editable field.
    • permissions (array): The array list of permissions added or removed from a role.
    • status (boolean): the status of the role, it indicates that the role is enabled or disabled.
  • Body:
    {
        "module": "admin",
        "param": "modify-role",
        "args": {
            "id": 2,
            "name": "role 2 updated",
            "permissions": [1,2,4],
            "status": true
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100018"
            },
            "timestamp": 1605696564,
            "language": "en"
        }
    + Error:
        {
            "success": 0,
            "error": "001412",
            "timestamp": 1605696596,
            "language": "en"
        }

24. Module Admin: Delete Role

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • id (int): The role’s id is a unique identifier.
  • Body:
    {
        "module": "admin",
        "param": "modify-role",
        "args": {
            "id": 2
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100021"
            },
            "timestamp": 1609141987,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1609149187,
                "uid": "GS99CxRS3Sq7"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "001414",
            "timestamp": 1609142402,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1609149602,
                "uid": "GS99CxRS3Sq7"
            }
        }

25. Module Admin: Show Module

  • Method: POST
  • URL: http://localhost:3040/api
  • Header:
    + content-type: application/json
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Argument:
    • module (string): name of module… reg/auth/user/admin/gdpr/general
  • Body:
    {
        "module": "admin",
        "param": "show-module",
        "args": {
            "module": "admin"
        },
        "language": "en",
        "timestamp": "123456789"
    }
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": {
                    "description": "This is a module",
                    "language": "en",
                    "name": "Module Admin",
                    "version": "1.0.1"
                }
            },
            "timestamp": 1609231251,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1609238451,
                "uid": "GS99CxRS3Sq7"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "002000",
            "timestamp": 1609231545,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1609238745,
                "uid": "GS99CxRS3Sq7"
            }
        }

26. Module General: Status (return: Ugene version, Allow/Forbid registration, timestamp)

  • Method: GET
  • URL: {{local}}/api/general/status/en
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": {
                    "Config": {
                        "comfirmation-email": true,
                        "allow-registration": true,
                        "sendmail-delete-user": true
                    },
                    "App": {
                        "app-name": "Ugene",
                        "default-language": "en"
                    }
                }
            },
            "timestamp": 1614078179,
            "language": "en",
            "session": {}
        }
    + Error:
        {
            "success": 0,
            "error": "002004",
            "timestamp": 1603954843,
            "language": "en"
        }

27. Module GDPR: Restrict

  • Method: GET
  • URL: {{local}}/api/gdpr/restrict/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100019"
            },
            "timestamp": 1614078876,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614086076,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "002004",
            "timestamp": 1607418296,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1607425496,
                "uid": "01jChEVhNA5N"
            }
        }

28. Module GDPR: Export Data

  • Method: GET
  • URL: {{local}}/api/gdpr/export-data/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100020"
            },
            "timestamp": 1614079346,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614086546,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "002004",
            "timestamp": 1607418296,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1607425496,
                "uid": "01jChEVhNA5N"
            }
        }

29. Module GDPR: Show Data

  • Method: GET
  • URL: {{local}}/api/gdpr/show-data/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "data": {
                    "user-config": [
                        {
                            "id": 1,
                            "uid": "8OZlv8UJkUCJ",
                            "config-name": "Authentication Two Factor",
                            "config-group": "security",
                            "config-key": "auth_two_factor",
                            "current-value": "0",
                            "default-value": "0",
                            "status": true,
                            "created_at": 1607585309,
                            "updated_at": 1607585309
                        }
                    ],
                    "user-hash": [
                        {
                            "id": 1,
                            "uid": "8OZlv8UJkUCJ",
                            "hash": "bM8wSygFFgmi0V7k2LqPQtLHUtz3KGFiPS1cCrEwV7I30QpXvsaCWV2ncD4ebBMg",
                            "param": "restore-pwd",
                            "email": "vucongthanh92@gmail.com",
                            "livetime": 1607671971,
                            "is_verified": true,
                            "created_at": 1607585571,
                            "updated_at": 0,
                            "verified_at": 1607585582
                        },
                        {
                            "id": 2,
                            "uid": "8OZlv8UJkUCJ",
                            "hash": "Ki5YnqvAIAVQwrrJeJguzvPDhi7qJOPuXhP5C1OixUMPhs7LzdYtcMmXxBdLJ8p3",
                            "param": "restore-pwd",
                            "email": "vucongthanh92@gmail.com",
                            "livetime": 1607673013,
                            "is_verified": true,
                            "created_at": 1607586613,
                            "updated_at": 0,
                            "verified_at": 1607586652
                        },
                        {
                            "id": 3,
                            "uid": "8OZlv8UJkUCJ",
                            "hash": "hzgKxDAqBQHAyMqpdFlEYtPz8p5up7K8OIsS1R8EB4QkgT6GVnuNvDL6fETwD24L",
                            "param": "restore-pwd",
                            "email": "vucongthanh92@gmail.com",
                            "livetime": 1607673464,
                            "is_verified": true,
                            "created_at": 1607587064,
                            "updated_at": 0,
                            "verified_at": 1607587074
                        },
                        {
                            "id": 4,
                            "uid": "8OZlv8UJkUCJ",
                            "hash": "KbeAPPtoD2H8PJFy856Xa8PnPxqzJjbfexlPFQR3C5cC9lyHOlUhKvMiXXWTW3WK",
                            "param": "restore-pwd",
                            "email": "vucongthanh92@gmail.com",
                            "livetime": 1607674132,
                            "is_verified": true,
                            "created_at": 1607587732,
                            "updated_at": 0,
                            "verified_at": 1607587743
                        }
                    ],
                    "user-info": {
                        "id": 1,
                        "uid": "8OZlv8UJkUCJ",
                        "username": "admin",
                        "email": "vucongthanh92@gmail.com",
                        "is_admin": true,
                        "deleted": false,
                        "mailsent": 0,
                        "mailconfirmed": 0,
                        "completed": true,
                        "restricted": false,
                        "status": true,
                        "created_at": 1607585309,
                        "updated_at": 0,
                        "logged_at": 1608006570
                    }
                }
            },
            "timestamp": 1608007712,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1608014912,
                "uid": "8OZlv8UJkUCJ"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "002004",
            "timestamp": 1607418296,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1607425496,
                "uid": "01jChEVhNA5N"
            }
        }

30. Module GDPR: Forget Me

  • Method: GET
  • URL: {{local}}/api/gdpr/forget-me/en
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Response:
    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100020"
            },
            "timestamp": 1614138406,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614145606,
                "uid": "xSMTRf5DTAur"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "003014",
            "timestamp": 1614138668,
            "language": "en",
            "session": {}
        }

31. Module User: Upload Avatar

  • Method: PUT
  • URL: {{local}}/api
  • Header:
    + content-type: multipart/form-data
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Body: formdata: –form ‘source=@/home/francis/Pictures/sample_5184×3456.bmp’ –form ‘type=avatar’ –form ‘module=user’ –form ‘param=upload-avatar’

  • Response:

    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100100"
            },
            "timestamp": 1614336093,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614343293,
                "uid": "A2JYaf3BTLqp"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "003014",
            "timestamp": 1614138668,
            "language": "en",
            "session": {}
        }

32. Module User: Upload File

  • Method: PUT
  • URL: {{local}}/api
  • Header:
    + content-type: multipart/form-data
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Body: formdata: –form ‘source=@/home/francis/Download/demo.txt’ –form ‘type=file’ –form ‘module=user’ –form ‘param=upload-file’

  • Response:

    + Success:
        {
            "success": 1,
            "answer": {
                "message": "100100"
            },
            "timestamp": 1614336093,
            "language": "en",
            "session": {
                "completed": 1,
                "is_admin": 1,
                "session_exp": 1614343293,
                "uid": "A2JYaf3BTLqp"
            }
        }
    + Error:
        {
            "success": 0,
            "error": "003014",
            "timestamp": 1614138668,
            "language": "en",
            "session": {}
        }

33. Module User: Download File

  • Method: GET
  • URL: {{local}}/download/file/42COG9mX6z
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Parameter:
    • 42COG9mX6z: File ID (fileid)

34. Module User: Show Avatar

  • Method: GET
  • URL: {{local}}/image/user/avatar/JntCFcdi2y3p
  • Header:
    + X-Authorization-Token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3Nfa2V5IjoiSW9BOG1Bb2ZCVjRTZDd2VjdvVFhpVEJIMEZua0wzNTRmYU5ZRVd5STRjM1o2TlhFIiwiZXhwIjoxNjA2Mjk3MDM1fQ.QXs-tSEZ0a__SwVXR7RmTA0UIJ_WdbFVNibUqrx3h_s
  • Parameter:
    • JntCFcdi2y3p: uid. If uid is not exist in parameter. it will get from token