Target

Targets.batch_create_or_update

Creates or updates Target records in one request: an item with an id updates that record, an item without one creates a new record.

post/entities/Targets/batch-modify

Request

Query parameters

validation-levelinteger

Bit mask that relaxes validation on this write. 0 (the default) validates everything. Bits: 2 skip unchanged fields, 4 skip admin-defined validations, 8 allow read-only fields, 16 skip relation checks, 32 skip value checks, 64 skip invalid recalculations, 128 skip step-checklist gates, 256 add conditional field requirements, 512 skip uniqueness checks. Add bits together (20 = 4 + 16); member names and comma lists such as 4,16 work too. A value with an internal-only bit is refused with HTTP 400, code 117.

rollback-method0 | 1

0, the default: one failed item fails the whole batch (HTTP 422, or 404 for an unknown id) and nothing is written. 1: the valid items are written and the call answers 200 with success false and one result per item, an id or an error, in input order. Check every item.

Request body

calculation_type1 | 2 | 3

What the target measures: revenue from opportunities won, or the number of leads qualified or created in the target period.

Integer enum value: 1 - Revenue, 2 - LeadQualified, 3 - LeadCreated

currency_idstring uuid

Id of the target currency.

descriptionstring

Free-text description shown alongside the target.

is_activeboolean

When true, the target is currently being tracked; when false, the target is a draft or has been deactivated.

namestring

Name of the entity and its default text representation.

owner_idstring uuid

Id of the owning user.

period_fromstring date

First date of the active target period. Set when is_active is true; recomputed from settings.period when activated.

period_tostring date

Last date of the active target period.

target_client_idstring uuid

Id of the assignee user.

type1 | 2 | 3 | 4

Kind of target: a User target for target_client, a group target that is split into or combines user targets, or a Simulated what-if target.

Integer enum value: 1 - User, 2 - GroupFromUser, 3 - GroupFromExisting, 4 - Simulated

revisioninteger

Revision when entity was lastly changed.

idstring uuid

ID of object to update.

Example request

[
  {
    "calculation_type": 1,
    "currency_id": "01234567-abcd-dcba-ffff-000000000000",
    "description": "string",
    "name": "string",
    "owner_id": "01234567-abcd-dcba-ffff-000000000000",
    "period_from": "2019-01-01",
    "period_to": "2019-01-01",
    "target_client_id": "01234567-abcd-dcba-ffff-000000000000",
    "type": 1,
    "revision": 1
  }
]

Response

Result per item, in request order: the id of the created or updated record, or the error.

successboolean

True when the request succeeded; false on error.

Example response

{
  "success": true,
  "data": [
    {
      "http_status": 400,
      "code": 117,
      "name": "ERROR_PARAMETER_INVALID"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.