create_resource

To create a new resource, use the core/create_resource method.

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

Parameters

Parameter Description
creatorId The ID of the user that should be indicated as the creator of the new resource.
name Resource name (4–50 characters).
dataFlags Flags with the resource properties for the response (see Resources).
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 they had no account. To create a resource for such a user, use skipCreatorCheck=1. The flag is used for that purpose only. The purpose of this limitation is to protect the hierarchy.

Response

If the request is completed successfully, the response is returned in the following format:

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

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

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters, or the length of the name parameter is out of bounds (4–50 characters).
6 One of the following errors:
  • Failed to fetch the creator with the specified ID, or you have no Act on behalf of this user access right to the creator.
  • The current user doesn’t have the Can create items flag (0x04).
  • Failed to create the resource because of the billing rules.
7 Failed to check the create_resources billing transaction.
1002 A resource with this name already exists.
2014 The selected user is the creator of some system objects.

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