Export defects
POST
/defects/exportExport the list of defects (in JSON format for CSV generation)
Example
Section titled “Example”Use resource IDs from your own project. Keep the API token in your server or CI environment.
import { createConfiguration, ExportApi } from '@testcollab/sdk';
const config = createConfiguration(process.env.TESTCOLLAB_TOKEN!);const api = new ExportApi(config);
const result = await api.exportDefects({ "exportDefectsPayload": { "project": 123, "exportAs": "csv", "criteria": "all", "fields": [] }});console.log(result);curl --request POST \ "https://api.testcollab.io/defects/export?token=$TESTCOLLAB_TOKEN" \ --header 'Content-Type: application/json' \ --data '{ "project": 123, "export_as": "csv", "filter_model": "example", "sort_model": "example", "criteria": "all", "defects": [], "fields": [], "remove_tags": true, "release": 123}'Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
project |
number | Yes | Project ID |
export_as |
string | Yes | Export data as CSV/EXCEL Values: csv, excel. |
filter_model |
string | No | Stringified filter object (Ag-grid filters) |
sort_model |
string | No | Stringified array of sort model objects (Ag-grid sort models) |
criteria |
string | Yes | Export selected or all defects. If none is selected and filter is present then all filtered defects will be considered. Values: all, selected. |
defects |
Array of number | No | Selected defect IDs - will be considered only if criteria is selected. |
fields |
Array of string | Yes | Fields provided here will be considered for export. If none then all default fields. |
remove_tags |
boolean | No | Strip HTML tags from text fields |
release |
number | No | Filter defects by release ID |
Response
Section titled “Response”200 — Export result with header row and defect data
| Field | Type | Required | Description |
|---|---|---|---|
header_row |
string | No | Stringified header |
testCases |
Array of string | No | Array of stringified test case data for export |
{ "header_row": "example", "testCases": []}Errors
Section titled “Errors”| Status | Meaning |
|---|---|
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not found |
500 |
Internal server error |