You need to create an object type in AppGallery Connect.
Sign in to AppGallery Connect and click Development and services.
Click the project for which you want to create an object type.
Go to Serverless > Cloud DB.
Click Add on the Object Type tab page.

Set Object Type Name to BookInfo, and click Next.

Click +Add Field to add the following fields, and click Next.
| Field | Type | Primary Key | Not Null | Encrypt | Default Value |
|---|---|---|---|---|---|
| id | Integer | ✓ | ✓ | – | – |
| bookName | String | – | ✓ | – | – |
| author | String | – | – | – | – |
| price | Double | – | – | – | – |
| borrowerId | Integer | – | – | – | – |
| borrowerName | String | – | – | – | – |
| borrowerTime | Date | – | – | – | – |
Click the plus sign (+) to add an index named bookName, and click Next.

Set role permissions and click OK.
| Role | query | upsert | delete | Description |
|---|---|---|---|---|
| Everyone | ✓ | ✓ | ✓ | All users, including authenticated and non-authenticated users. This role has the query permission by default and can be granted the upsert and delete permissions. For example, if the upsert permission is selected for this role, this role can write data to the object type. However, you are not advised to grant the upsert and delete permissions to the Everyone role. If Encrypt is selected for fields that belong to the object type, the full-process encryption function is enabled. In this case, the Everyone role does not have the query, upsert, and delete permissions, and the role permissions cannot be modified. |
| Authenticated user | ✓ | ✓ | ✓ | Users who have passed the AppGallery Connect sign-in authentication. This role has the query permission by default and can be granted the upsert and delete permissions. For example, if the upsert permission is selected for this role, this role can write data to the object type. If Encrypt is selected for fields that belong to the object type, the full-process encryption function is enabled. In this case, the Authenticated user role does not have the query, upsert, and delete permissions, and the role permissions cannot be modified. |
| Data creator | ✓ | ✓ | ✓ | Authenticated users who create data. This role has all permissions by default and can customize the permissions. For example, if the upsert permission is selected for this role, this role can write data to the object type. Each data record has a corresponding creator (namely an app user). Data creators can upsert or delete the data created only by themselves. The information about data creators is stored in the system table of data records. |
| Administrator | ✓ | ✓ | ✓ | App developers who access Cloud DB through AppGallery Connect or Function as a Service (FaaS). This role has all permissions by default and can customize the permissions. For example, if the upsert permission is selected for this role, this role can write data to the object type. An administrator can manage and configure the permissions of other roles. |
View the created object type in the object type list.
Select the created object type BookInfo and click Export. If no object type is selected, all object types will be exported by default.

Set the file format to JSON and click OK. This file will be used when you import an object type file.
