---
title: "Add/remove/update mappings between 'TestRun' entities and other entities"
method: POST
path: "/testrun/mapping/bulk/{otherEntities}"
tags: ["TestRun"]
---

# Add/remove/update mappings between 'TestRun' entities and other entities

`POST /testrun/mapping/bulk/{otherEntities}`

## Request

- Base URL: `https://app.testiny.io/api/v1`
- URL: `https://app.testiny.io/api/v1/testrun/mapping/bulk/{otherEntities}`
- Auth: API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/testiny/apis/testiny-api/docs/testrun/mapping/bulk/:otherEntities/post.ts> (a function with typed inputs; its response is checked against the schema)

Adds/Removes/Updates mappings between entities (e.g. test cases, test runs, etc.) if the mapping is defined. Id values are named by entity e.g. 'testcase_id', 'testrun_id' (see request schema)

## Path parameters

- `otherEntities` string, required

## Query parameters

- `op` 'add' | 'update' | 'add_or_update' | 'delete'

## Request body

- union
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `testcase_id` integer, required
      - `testrun_id` integer, required
    - `mapped` TestRunTestCaseValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `testrun_id` integer: The associated test run id
      - `testcase_id` integer: The associated test case id
      - `testcase_source_query_id` integer: The id of the testcase source query if created from a test plan query
      - `testcase_source_folder_id` integer: The id of the folder if created in a test plan from a folder
      - `assigned_user_id` integer: The global user id of the user assigned to the associated test case in the associated test run if 'assigned_to' is 'USER'
      - `assigned_to` string: The assignee of the associated test case in the associated test run - Can be USER,OWNER,ANY
      - `$assignee_name` string: The resolved display name of the test case assignee - readonly
      - `result_status` string: The result status of the associated test case in the associated test run - allowed values are: NOTRUN,PASSED,FAILED,BLOCKED,SKIPPED. Custom result states as configured in the custom field of type 'result_status'.
      - `result_per_step` ResultPerStep[]
        - `rid` string, required
        - `idx` number, required
        - `res` string, required
      - `result_at` string, date-time: The last modification time for the result status
      - `result_by` number: The id of the user who last changed the result status - or zero if modified by the system
      - `$comment_count` number: The number of comments associated with this testcase/testrun - readonly
      - `$workitem_count` number: The number of work items associated with this testcase/testrun - readonly
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `comment_id` integer, required
      - `testcase_id` integer, required
      - `testrun_id` integer, required
    - `mapped` TestRunCommentValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `comment_id` integer: The comment_id property
      - `testrun_id` integer: The testrun_id property
      - `testcase_id` integer: The testcase_id property
      - `reference` CommentReference
        - `type` 'STEP', required
        - `rid` string, required
        - `rowNum` number, required
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `blob_id` integer, required
      - `testcase_id` integer, required
      - `testrun_id` integer, required
    - `mapped` TestRunBlobValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `blob_id` integer: The blob_id property
      - `testrun_id` integer: The testrun_id property
      - `testcase_id` integer: The testcase_id property
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `agentsession_id` integer, required
      - `testcase_id` integer, required
      - `testrun_id` integer, required
    - `mapped` TestRunSessionValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `agentsession_id` integer: The agentsession_id property
      - `testrun_id` integer: The testrun_id property
      - `testcase_id` integer: The testcase_id property
      - `data` object: Session data
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `milestone_id` integer, required
      - `testrun_id` integer, required
    - `mapped` MilestoneTestRunValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `milestone_id` integer: The milestone_id property
      - `testrun_id` integer: The testrun_id property
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `testcase_id` integer, required
      - `testrun_id` integer, required
      - `workitem_id` integer, required
    - `mapped` WorkItemTestRunTestCaseValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `workitem_id` integer: The workitem_id property
      - `testcase_id` integer: The testcase_id property
      - `testrun_id` integer: The testrun_id property
      - `workitem_type` string: The workitem_type property
  - object[]
    - `ids` object: An object of entity id keys for the member entities
      - `testrun_id` integer, required
      - `workitem_id` integer, required
    - `mapped` WorkItemTestRunValues
      - `created_at` string, date-time: The creation time for this entity or mapping value
      - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
      - `modified_at` string, date-time: The last modification time for this entity or mapping value
      - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
      - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
      - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
      - `workitem_id` integer: The workitem_id property
      - `testrun_id` integer: The testrun_id property
      - `workitem_type` string: The workitem_type property

## Other responses

- `4XX`: The request failed because invalid request parameters or data were supplied or access was denied.
- `5XX`: The request failed because an error occurred during processing of the request.

---

[API](https://skmtc.dev/testiny/apis/testiny-api.md) - [All operations](https://skmtc.dev/testiny/apis/testiny-api/llms.txt) - [OpenAPI document](https://skmtc.dev/testiny/apis/testiny-api/revisions/8f7643b2429d?raw)
