Add

[POST] .../v1/targetsetting/add

Adds target settings. Use this method to add several settings in one request to existing unfinished targets. The request body is a JSON array of TargetSettingAdd items. The array must contain from 1 to 250 items; each item must provide target_id, type, non-empty value and include. ReceiptCount and AverageReceipt targets do not accept settings. CrmDealWonAmount targets accept Pipeline and DealType settings; other target types accept Item and ItemGroup settings. The caller must have edit permission for each target owner scope; invalid batch size, invalid item fields, finished targets, denied permissions, unsupported setting type and storage errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
include Boolean Required Setting state. true enables the setting; false disables it.
target_id Int64 Required Target ID. The target must exist, be unfinished and be editable by the current user.
type String Required Target setting type: Item and ItemGroup are allowed for sales/item targets; Pipeline and DealType are allowed for CrmDealWonAmount targets. Allowed values: Default, Item, ItemGroup, Pipeline, DealType.
value String Required Setting value stored as an entity identifier string. Required and limited to 30 characters.

Request Example

[
  {
    "target_id": 12,
    "type": "Item",
    "value": "145",
    "include": true
  },
  {
    "target_id": 12,
    "type": "ItemGroup",
    "value": "7",
    "include": false
  }
]

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 31
  }
}