create_resource

The create_resource function is used to create new resources.

Copied!
svc=core/create_resource&params={"creatorId":<long>,
				 "name":"<text>",			     
				 "dataFlags":<uint>,
                                 "skipCreatorCheck":<bool>}

Parameters

NameDescription
creatorIdThe ID of the user that should be indicated as the creator of the new resource. 
nameResource name (4–50 characters).
dataFlagsThe flags with the resource properties for the returned result. See the resources page. 
skipCreatorCheck

A special flag. 1 — enable. The default value is 0.

You can't create an account for a user that has created items while he had no account. To create a resource for such user, use skipCreatorCheck=1. The flag is used for that purpose only. The purpose of this limitation is to protect the hierarchy. 

Returned result

Copied!
{
	"item":{	/* resource created */
		...	
	},
	"flags":<uint>	/* applied flags with properties */
}

The format of the item parameter is described on the resources page.

Possible error codes:

CodeDescription
2014The selected user is the creator of some system objects.
1002Failed to fetch the creator with the desired ID.
7Failed to check the create_resources billing.
6

One of the following errors:

  • failed to fetch the creator with the desired ID;
  • current user doesn't have the ADF_STORAGE_USER_FLAG_ITEM_CREATOR flag;
  • failed to create the resource because of the billing rules.
4Wrong input parameters or the length of the name parameter is out of bounds (4–50 characters).
Download PDF file
Download Word document

See also