Create or update user
Updated date: 17/03/2025
Updated by: VNPT eContract's team
Purpose
The function that creates new or updates existing information of one or multiple users within the system.
- Request URL:
/api/users/create-or-update
- HTTP method:
POST
- HTTP content-type:
application/json
- Authorize:
Bearer token
- Parameter:
Key | Type | Description |
---|---|---|
code | string | [Required] Code of user |
userName | string | [Required] Username of user |
name | string | Full Name of user |
email | string | Email of user |
phone | string | Phone number |
groupIds | Array[int] | Array of group user Ids |
departmentIds | Array[int] | Array of department Ids |
roleIds | Array[Guild] | Array of role Ids |
taxcode | string | Tax code of user |
address | string | Address of user |
fax | string | Fax number of user |
description | string | Description |
signatureText | string | Default signature text |
signConfirmationEnabled | boolean | Sign, approve using two-factor authentication |
generateSelfSignedCertEnabled | boolean | Generate Self-signed certificate |
status | int | Status of user 1: Enabled -1: Disabled |
receiveOtpMethod | int | Receive OTP method 1: Email 2: SMS -1: None |
receiveNotificationMethod | int | Receive document notification method 0: Email 1: SMS -1: None |
signMethod | int | Sign method 1: (Only old version) Sign draw 2: VNPT Smart CA 3: Sign Token |
receiveInfoAccountMethod | int | Receive account information 0: Email 1: SMS -1: None |
Sample request
[
{
"code": "USER01",
"username": "your_username",
"name": "Nguyen Van A",
"email": "email_address",
"phone": "0919XXXXXX",
"taxcode": "1234567890",
"address": "District 3, Ho Chi Minh City",
"fax": "123",
"description": "",
"signatureText": "",
"signConfirmationEnabled": true,
"generateSelfSignedCertEnabled": true,
"status": 1,
"receiveOtpMethod": 1,
"receiveNotificationMethod": 0,
"signMethod": 2,
"groupIds": [
1014
],
"departmentIds": [
33
],
"roleIds": [
"2b999cd0-32ec-4e4a-16b8-08da6df5fc5a"
]
}
]
Sample response body
{
"data": [
{
"id": 8072,
"createdDate": "2023-06-28T14:31:30.9534748",
"comId": 164,
"code": "USER01",
"name": "Nguyen Van A",
"phone": "0919XXXXXX",
"email": "email_address",
"isValid": false,
"signConfirmationEnabled": true,
"isAccountLocked": false,
"signatureText": "",
"signMethod": {
"value": 2,
"description": "VNPT Smart CA"
},
"status": {
"value": 1,
"description": "Enabled"
},
"receiveOtpMethod": {
"value": 1,
"description": "Email"
},
"receiveNotificationMethod": {
"value": 0,
"description": "Email"
},
"personalCertificateId": 5111
}
],
"success": true,
"code": 0,
"messages": [
"Create 0 user success, update 1 user success."
]
}