Description

Create new Category for an account. It is possible to create several categories at a time.

URI

/api/account/{accountId}/configuration/le-categories/categories?v=2.0

HTTP Methods

POST

Response Codes

201 Created

400 Bad Request

401 Not Authorized

403 Forbidden

404 Data not found

409 Conflict

500 Internal server error

Formats

JSON

Path Parameters

Parameter Description Notes
accountId LP site id Validation fail error code: 400 Type: String

Query Parameters

Parameter Description Notes
select dynamic selection of response fields Default: $all alias: id,deleted,name,order,proposed Available aliases: $all: id,deleted,name,order,proposed $summary: id,deleted,name type: YOGA 'gdata' dialect validation error: 400 supported fields: any in response body **yoga GData dialect builder url: https://github.com/skyscreamer/yoga/wiki/Using-the-Selector-Builder-GUI

Request Headers

Header Description
Authorization Contains token string to allow request authentication and authorization. See the doc for more details.

Request Body

The request body is able to accept single JSON object as shown below, or a JSON array [] of such objects.

Notes:

  1. Order attribute is not mandatory. It is a sequential and consecutive value managed by the server.

  2. If order is not passed and there are multiple items in the request, order assigned by the server is not guaranteed to be the sorting in the request body.

  3. Sending categories to be created with duplicate order value results in a BAD_REQUEST response code.

  4. Order value has to greater than zero. Failing this validation will result in a BAD_REQUEST response code.

  5. Should you choose to pass order value, you may have order value collision with existing order resulting in a BAD_REQUEST response code.

Single category creation

{ "deleted":false, "name":"iPhone4", "order":10, "proposed":true }

For the above body:

  • if no categories exist, the newly created category is assigned order 1.

  • if n categories exist, where n < 10, the newly created category is assigned order n + 1.

  • if n categories exist, where n >= 10, order collision is detected resulting in a BAD_REQUEST response code.

Multiple category creation

Note: order assigned by the server is not guaranteed to be the order in the request body

[{ "deleted": false, "name": "A1", "proposed": false },{ "deleted": false, "name": "A2", "order": "10", "proposed": false },{ "deleted": false, "name": "A3", "proposed": false }]

For the above body:

  • if no categories exist, category A2 is assigned order 1 and the other categories passing null orders are assigned order value of 2,3 randomly.

  • if n categories exist, where n < 10, category A2 is assigned order n + 1 and the other categories passing null orders are assigned order value of n + 2, n + 3 randomly.

  • if n categories exist, where n >= 10, order collision is detected resulting in a BAD_REQUEST response code.

Attribute Description Notes
id Account Config object’s unique id. Required Type: long number
delete Whether the item is deleted or not Type: boolean

Response Headers

Header Description
ac-revision Account config object type collection revision
location URI Location of the newly created resource. This header is included only when the request created single object.

Response Body

Newly created Category json.