Bulk operations

Delete, update, and create operations can be performed on more than one entity with a single REST call. All entities in a bulk operation must be of the same entity type. For example, you cannot create a requirement and a defect in the same operation.

The bulk operation executes for all of the entities even if there is one or more failure. The QCRestException contains the information on which individual operations failed and which succeeded.

The total number of entities that can be handled in a single bulk operation is set with the site parameter, REST_API_MAX_BULK_SIZE. The default value is 2000.

Delete

To delete multiple entities of a single entity type, pass the IDs as a query parameter in an HTTP DELETE call. For example:

.../rest/domains/<DOMAIN>/projects/<PROJECT>/<ENTITIES>?ids-to-delete=17,28,31,46

Post, Put

To create or update more than one entity of the same entity type, pass the data in the request body. Pass an XML string compliant with the Entities Collection Schema or a JSON string of the same format returned by a GET operation on the collection.

To create entities, use an HTTP POST call. To update entities, use an HTTP PUT call.

Pass one of these content-type headers:
content-type="application/xml;type=collection"
content-type="application/json;type=collection"

Use the content-type header that matches the data you are sending.

Return Values

On success, a bulk operation returns HTTP 200 and the collection of entities affected. The affected entities are returned in an XML string compliant with the Entities Collection Schema.

If all of the operations fail, HTTP 500 is returned.

If some, but not all, of the operations fail, HTTP 409 is returned. The details of which of the individual operations succeeded and which failed are in a BulkOperationFailed element in the returned QCRestException.

Example of Bulk Operation Exception Data