update_admin_field
To create, update, or delete an admin field of an item, use the item/update_admin_field method. To send a request, you should have the View admin fields and Manage admin fields access rights to the item.
Endpoint
svc=item/update_admin_field¶ms={
"itemId":<long>,
"id":<long>,
"callMode":"<text>",
"n":"<text>",
"v":"<text>"
}
Parameters
The request must contain the following parameters:
| Parameter | Description |
|---|---|
itemId |
Item ID. |
id |
Admin field ID. When creating an admin field, specify any value, for example, 0. The system ignores it and assigns the smallest free ID within the item (1, 2, and so on). IDs of deleted fields are reused. |
callMode |
Action: create, update, or delete. |
To create or update an admin field, also specify the following parameters:
| Parameter | Description |
|---|---|
n |
Admin field name. |
v |
Admin field value. |
Returned result
If an admin field is created or updated successfully, a response in the following format is returned:
[
<long>, /* admin field ID */
{
"id":<long>, /* admin field ID */
"n":"<text>", /* name */
"v":"<text>", /* value */
"ct":<uint>, /* creation time (Unix timestamp) */
"mt":<uint> /* last modification time (Unix timestamp) */
}
]
If an admin field is deleted successfully, a response in the following format is returned:
[
<long>, /* admin field ID */
null
]
Otherwise, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters. For example, callMode has an unsupported value, or the admin field to update isn’t found. |
| 6 | Failed to create the admin field, or the admin field to delete isn’t found. |
| 7 | Failed to fetch the item. The user may not have the View admin fields and Manage admin fields access rights to the item. |