updateUser
Updating a single user object. π This method requires authorization.
Descriptionβ
This method updates the authorized user's data object. It returns a Promise that resolves to an IUserEntity object.
Users.updateUser(
body,
body.formIdentifier,
body.langCode,
body.formData,
body.notificationData,
body.state,
langCode
);
Parameters schemaβ
Schema
body(required): IUserBody
Request body
example:
{
"formIdentifier": "reg",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": {
"marker": "last_name",
"type": "string",
"value": "Username"
},
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
},
"state": {}
}
body.formIdentifier(required): string
Text identifier of the form.
example: "form_12345"
body.langCode: string
Language code for localization. Default: "en_US".
body.formData: IAuthFormData | IAuthFormData[]
Form data object or array of form data objects.
example:
[
{
"marker": "first_name",
"type": "string",
"value": "John"
},
{
"marker": "last_name",
"type": "string",
"value": "Doe"
}
]
body.notificationData: object
Object containing notification data, including email and phone information.
example:
{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
body.state: any
Object containing additional state information.
example:
{
"key": "value"
}
langCode: string
Language code. Default: "en_US"
example: "en_US"
Examplesβ
Minimal exampleβ
// 1. Authawait AuthProvider.auth("email", {
"authData": [
{
"marker": "email_reg","value": "your@email.com",},
{
"marker": "password_reg","value": "yourPassword"}
]
});
// 2. Update userconst body = {
"formIdentifier": "reg","authData": [{
"marker": "password","value": "yourPassword"}
],"formData": {
"marker": "last_name","type": "string""value": "Username"},
"notificationData": {
"email": "example@oneentry.cloud","phonePush": ["+99999999999"],"phoneSMS": "+99999999999",}
,"state": {}
};
const response = await Users.updateUser(body);
Examples for body parameter with different types dataβ
Example with attribute of simple type "string", "integer", "float"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": {
"en_US": [
{
"marker": "last_name",
"type": "string",
"value": "Π€Π΅Π΄ΠΎΡ ΠΠ²Π°Π½ΠΎΠ²"
}
]
},
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
},
"state": {}
}
Example with attributes of type "date", "dateTime", "time"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "birthday",
"type": "date",
"value": {
"fullDate": "2024-05-07T21:02:00.000Z",
"formattedValue": "08-05-2024 00:02",
"formatString": "DD-MM-YYYY HH:mm"
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attribute of type "text"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "text",
"value": {
"htmlValue": "<p>ΠΡΠΎ Ρ</p>",
"plainValue": "ΠΡΠΎ Ρ",
"mdValue": "*ΠΡΠΎ Ρ*",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with an attribute of type "textWithHeader"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "textWithHeader",
"value": {
"header": "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ",
"htmlValue": "<p>ΠΡΠΎ Ρ</p>",
"plainValue": "ΠΡΠΎ Ρ",
"mdValue": "*ΠΡΠΎ Ρ*",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attributes of type "image" and "groupOfImages"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "avatar",
"type": "image",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585,
"previewLink": "",
"params": {
"isImageCompressed": true
}
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attribute of type "file"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "picture",
"type": "file",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attribute of type "radioButton"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "selector",
"type": "radioButton",
"value": {
"title": "red",
"value": "1",
"extended": {
"value": "ΠΊΡΠ°ΡΠ½ΡΠΉ",
"type": "string"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attribute of type "list"β
{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "selector",
"type": "list",
"value": [
{
"title": "red",
"value": "1",
"extended": {
"value": "ΠΊΡΠ°ΡΠ½ΡΠΉ",
"type": "string"
}
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with an attribute of type "entity" (nested list)β
{
"formIdentifier": "reg",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "entity-selector",
"type": "entity",
"value": [
1,
2
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example with attribute of type "timeInterval"β
{
"formIdentifier": "reg",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "interval",
"type": "timeInterval",
"value": [
[
"2025-02-11T16:00:00.000Z",
"2025-02-13T16:00:00.000Z"
]
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}
Example returnβ
true