通知
本站点除 Legacy 产品与方案外,已迁移至 声网新文档中心 ,当前页面不再维护
Documentation
All
Console 官网 Community Technical support

How can I set user properties and classroom properties?

Type: Integration issues    Platform: All Platforms   Last Updated: 2021/10/15 00:41:08

Flexible Classroom supports custom user properties and classroom properties. The property consists of a property name and a property value. Each property name has only one property value.

You can modify the value of a custom user or classroom property through full modification or path modification:

Suppose the current custom user or classroom property is as follows:

{"key1":
   {"subkey1":"a",
    "subkey2":"b"
   },
 "key2":
   {"subkey3":"c",
    "subkey4":"d"
   }
}

There are several scenarios:

  • If you want to capitalize all values of subkey, you can pass the following JSON array when calling the API through full modification:

     {"key1":
        {"subkey1":"A",
         "subkey2":"B"
        },
      "key2":
        {"subkey3":"C",
         "subkey4":"D"
        }
     }
  • If you only want to capitalize the value in subkey1, changing a into A, for example, you can pass {"key1.subkey1":"A"} when calling the API through path modification.

  • If you want to add subkey5 with the value of E to key1, you can pass {"key1.subkey5":"E"} when calling the API. The properties after modification are:

     {"key1":
        {"subkey1":"A",
         "subkey2":"B",
         "subkey5":"E"
        },
      "key2":
        {"subkey3":"C",
         "subkey4":"D"
        }
     }

    Please note that if you pass {"key1": {"subkey5": "E"} }, all the original properties are overwritten.

  • You can add multiple properties once. For example, pass {"key1.subkey5":"E", "key2.subkey6":"F"}. The properties after modification are:

     {"key1":
        {"subkey1":"A",
         "subkey2":"B",
         "subkey5":"E"
        },
      "key2":
        {"subkey3":"C",
         "subkey4":"D",
         "subkey6":"F"
        }
     }