trash

In the top account, you can get the list of deleted macro-objects in the trash bin. You can also restore them using the account/trash method:

Copied!
svc=account/trash&params={"callMode":<text>, "guids":[<text>]}

Parameters

The request must contain the following parameters:

Parameter Description
callMode Possible values are list and restore. List is used to get the list of deleted objects. To restore the objects, specify the restore value.
guids Item GUIDs for restoring. Used for the restore callMode.

You can restore a deleted item no earlier than 20 minutes after it was deleted.

Response

If the request is completed successfully, the response for a list of macro-objects in the trash bin is as follows:

Copied!
{  
    "code":<uint>,  
    "items": [  
                {  
                    "guid":<text>,       /* GUID */  
                    "name":<text>,       /* Item name. */  
                    "tm":<uint>,         /* Time of deletion. */  
                    "type":<text>,       /* Macro-object type (for example, "avl_resource"). */  
                    "creator_id":<text>, /* ID of the creator. */  
                    "props":                                        	  
                    {  
                        "prop_name":<prop_type>,  /* List of public item properties (string, int, long, double). */                               ...  
                    }  
                },  
                ...  
    ]  
}  

The response for restoring macro-objects from trash:

Copied!
{
    "code":<uint>,
    "items": [
                {
                    "name":<text>,        /* Item name. */
                    "result":<uint>,      /* Result: 1 — success, 0 — failure. */
                    "type":<text>,         /* Macro-object type. */
                    "reason":<text>           /* Reason for a possible error. */     
                },
                ...
    ]
}

If the object could not be restored, the following reasons can be indicated in the response:

  • MAX_ITEMS_EXCEEDED. The limit set for the resource is exceeded.
  • TIMEOUT_20_MIN. You can restore a deleted item no earlier than 20 minutes after it was deleted.
  • NAME_NOT_UNIQUE. An item with the same name already exists.
  • PHONE1_NOT_UNIQUE. A unit with the same phone number already exists.
  • PHONE2_NOT_UNIQUE. A unit with the same second phone number already exists.
  • UID1_NOT_UNIQUE. A unit with the same unique ID already exists.
  • UID2_NOT_UNIQUE. A unit with the same second unique ID already exists.
  • INTERNAL_SERVER_ERROR. A server error occurred.

If the reason is empty and the result is 0, the item was not created by the creator of the account and cannot be restored.

If you find a mistake in the text, please select it and press Ctrl+Enter.