---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/api-reference

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ATF Code Coverage API

# ATF Code Coverage API {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 14 minutes to read  
The ATF Code Coverage API provides endpoints to compute code coverage from Automated Test Framework (ATF) runs. Coverage can be retrieved by filtered line numbers, for specific script IDs, or for all scripts covered by a set of test suite/test runs.

ATF code coverage is a tool that enables you to determine what percentage of code in a deployment request is covered by ATF test suites.

By default, if ATF test suites cover less than 70% of the code in a deployment request, ReleaseOps transitions the deployment request to the Reconciling state and a test failure task is automatically created. You can adjust the ATF code coverage threshold in the deployment request assessment playbook.
For more information, see [Set Automated Test Framework (ATF) code coverage](https://www.servicenow.com/docs/access?context=set-atf-code-coverage-threshold&version=australia&pubname=australia-application-development&ft:locale=en-US).

For information on ATF and Performance Analyzer, see [Testing and debugging applications](https://www.servicenow.com/docs/access?context=testing-and-debugging-applications&version=australia&pubname=australia-application-development&ft:locale=en-US).

For information on deployment analyzer, see [Deployment analyzer in ReleaseOps](https://www.servicenow.com/docs/access?context=deployment-analyzer&version=australia&pubname=australia-application-development&ft:locale=en-US).

## ATF Code Coverage - POST /now/atf/code_coverage/all {#ariaid-title2}

Aggregates coverage across all scripts covered by the provided ATF runs. Supports combining test suite runs and individual test runs.

### URL format

Versioned URL: /api/now/v1/atf/code_coverage/all

Default URL: /api/now/atf/code_coverage/all

### Supported request parameters

{#atf_code_covg-POST-all__entry__2}{#atf_code_covg-POST-all__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 1. Path parameters]

{#atf_code_covg-POST-all__entry__6}

| Name | Description |
|-|-|
| None |   |
[Table 2. Query parameters]

{#atf_code_covg-POST-all__entry__10}

| Name | Description |
|-|-|
| test_suite_result_ids | Required unless `test_result_ids` are provided. List of test suite result sys_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Suite Results \[sys_atf_test_suite_result\] Data type: Array of strings |
| test_result_ids | Required unless `test_suite_result_ids` are provided. List of test result sys_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Results \[sys_atf_test_result\] Data type: Array of strings |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script. Valid values: * true: Include detailed per-item coverage in the response body details object. * false: The response body details object will return empty or not at all. {#atf_code_covg-POST-all__ul_qm3_ycy_l3c} Default: false Data type: Boolean |
| sys_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided. Data type: Array of strings |
[Table 3. Request body parameters (JSON)]

### Headers

The following request and response headers apply to this HTTP
action only, or apply to this action in a distinct way. For a list of general headers used
in the REST API, see [Supported REST API headers](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-all__entry__20}{#atf_code_covg-POST-all__accept-RESTAPI}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
[Table 4. Request headers]

{#atf_code_covg-POST-all__entry__24}

| Header | Description |
|-|-|
| None |   |
[Table 5. Response headers]

### Status codes

The following status codes apply to this HTTP action. For a
list of possible status codes used in the REST API, see [REST API HTTP response
codes](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-all__entry__28}{#atf_code_covg-POST-all__entry-200-status-code}{#atf_code_covg-POST-all__entry-400-status-code}{#atf_code_covg-POST-all__entry-500-status-code}

| Status code | Description |
|-|-|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
[Table 6. Status codes]

### Response body parameters (JSON)

{#atf_code_covg-POST-all__table_10z_n1c_i8e__entry__2}

| Name | Description |
|-|-|
| link | Link to the request record. Data type: String |
| details.\<scriptId\> | Lists the ATF aggregation coverage percent of each custom test script by script sys_id. Data type: Number |
| api_request_sys_id | The sys_id of the request. Table: ATF code coverage API requests \[sys_atf_code_coverage_request\] Data type: String |
| result | Success or error message. Error response formats: * 400 Bad Request`{ "result": "Validation error: <specific_error_message>" }` * 500 Internal Server Error`{ "result": "Internal server error: <error_message>" }` {#atf_code_covg-POST-all__ul_apt_1ss_l3c} Possible errors: * Request body validation - `Request body is required and cannot be empty` * Test ID validation - `At least one valid (non-empty) ID must be provided in either test_result_ids or test_suite_result_ids` * Type mismatch - `Invalid data type in request parameters` {#atf_code_covg-POST-all__ul_qzs_kts_l3c} Data type: String |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the details property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided. Possible values: 0-100 Data type: Number |
| truncation_message | If request data was truncated during persistence, provides details about what scripts have truncated information. Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using glide.db.truncate_utf8 system property as described in the Additional information section. Valid values: * true: Request data was truncated during persistence. * false: Request data was not truncated during persistence. {#atf_code_covg-POST-all__ul_ihd_rdy_l3c} Data type: Boolean Default number of characters: 4000 |
[ ]

{#atf_code_covg-POST-all__table_10z_n1c_i8e}  

### cURL request

The following example shows how to retrieve all of the code coverage for a selected test result suite and test result.

    curl "https://instance.service-now.com/api/now/atf/code_coverage/all" \
    --request POST \
    --header "Accept:application/json" \
    --header "Content-Type:application/json" \
    --data "{
      \"test_suite_result_ids\": [\"5f81c7c4ff943210b88affffffffffc5\"],
      \"test_result_ids\": [\"bb8daec1ff103210b88affffffffff1c\"],
      \"verbose\": true,
      \"sys_scopes\": [\"x_my_app\", \"global\"]
    }" \
    --user 'username':'password'

Output:

    {
      "result": "success",
      "total": 73,
      "details": {
        "sys_script_include_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6": 85,
        "sys_script_include_b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7": 92,
        "sys_ui_script_c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8": 45,
        "sys_script_d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9": 68,
        "sys_script_include_e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0": 100
      },
      "api_request_sys_id": "f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1",
      "link": "https://instance.service-now.com/sys_atf_code_coverage_request.do?sys_id=f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1"
    }

## ATF Code Coverage - POST /now/atf/code_coverage/by_script_id {#ariaid-title3}

Computes coverage for specific script records.
To compute code coverage for all scripts covered by specified ATF runs, use the endpoint /now/atf/code_coverage/all.

### URL format {#atf_code_covg-POST-byScriptId__section_tr5_5b2_l3c}

Versioned URL: /api/now/v1/atf/code_coverage/by_script_id

Default URL: /api/now/atf/code_coverage/by_script_id

### Supported request parameters

{#atf_code_covg-POST-byScriptId__entry__2}{#atf_code_covg-POST-byScriptId__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 7. Path parameters]

{#atf_code_covg-POST-byScriptId__entry__6}

| Name | Description |
|-|-|
| None |   |
[Table 8. Query parameters]

{#atf_code_covg-POST-byScriptId__entry__10}

| Name | Description |
|-|-|
| test_suite_result_ids | Required unless `test_result_ids` are provided. List of test suite result sys_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Suite Results \[sys_atf_test_suite_result\] Data type: Array of strings |
| test_result_ids | Required unless `test_suite_result_ids` are provided. List of test result sys_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Results \[sys_atf_test_result\] Data type: Array of strings |
| script_array | Required. One or more valid script sys_ids to evaluate for code coverage. Must contain at least one valid (non-empty) script identifier. Null, empty, or whitespace-only entries are filtered out. Table: Metadata Tracing \[sys_traced_metadata\] Data type: Array |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script. Valid values: * true: Include detailed per-item coverage in the response body details object. * false: The response body details object will return empty or not at all. {#atf_code_covg-POST-byScriptId__ul_qm3_ycy_l3c} Default: false Data type: Boolean |
| sys_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided. Data type: Array of strings |
[Table 9. Request body parameters (JSON)]

### Headers

The following request and response headers apply to this HTTP
action only, or apply to this action in a distinct way. For a list of general headers used
in the REST API, see [Supported REST API headers](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-byScriptId__entry__22}{#atf_code_covg-POST-byScriptId__accept-RESTAPI}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
[Table 10. Request headers]

{#atf_code_covg-POST-byScriptId__entry__26}

| Header | Description |
|-|-|
| None |   |
[Table 11. Response headers]

### Status codes

The following status codes apply to this HTTP action. For a
list of possible status codes used in the REST API, see [REST API HTTP response
codes](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-byScriptId__entry__30}{#atf_code_covg-POST-byScriptId__entry-200-status-code}{#atf_code_covg-POST-byScriptId__entry-400-status-code}{#atf_code_covg-POST-byScriptId__entry-500-status-code}

| Status code | Description |
|-|-|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
[Table 12. Status codes]

### Response body parameters (JSON) {#atf_code_covg-POST-byScriptId__section_j35_dqx_l3c}

{#atf_code_covg-POST-byScriptId__table_10z_n1c_i8e__entry__2}

| Name | Description |
|-|-|
| link | Link to the request record. Data type: String |
| details.\<scriptId\> | Lists the ATF aggregation coverage percent of each custom test script by script sys_id. Data type: Number |
| api_request_sys_id | The sys_id of the request. Table: ATF code coverage API requests \[sys_atf_code_coverage_request\] Data type: String |
| result | Success or error message. Error response formats: * 400 Bad Request`{ "result": "Validation error: <specific_error_message>" }` * 500 Internal Server Error`{ "result": "Internal server error: <error_message>" }` {#atf_code_covg-POST-byScriptId__ul_apt_1ss_l3c} Possible errors: * Request body validation - `Request body is required and cannot be empty` * Script array validation results if the script_array request entries provided are null, empty, or whitespace - `"script_array is required and cannot be empty - script_array must contain at least one valid script identifier"` * Test ID validation - `At least one valid (non-empty) ID must be provided in either test_result_ids or test_suite_result_ids` * Type mismatch - `Invalid data type in request parameters` {#atf_code_covg-POST-byScriptId__ul_qzs_kts_l3c} Data type: String |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the details property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided. Possible values: 0-100 Data type: Number |
| truncation_message | If request data was truncated during persistence, provides details about what scripts have truncated information. Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using glide.db.truncate_utf8 system property as described in the Additional information section. Valid values: * true: Request data was truncated during persistence. * false: Request data was not truncated during persistence. {#atf_code_covg-POST-byScriptId__ul_ihd_rdy_l3c} Data type: Boolean Default number of characters: 4000 |
[ ]

{#atf_code_covg-POST-byScriptId__table_10z_n1c_i8e}

### Additional information {#atf_code_covg-POST-byScriptId__id_lvt_1qx_l3c}

Large request payloads may be truncated when persisted if the request data exceeds database field limits.  
The following fields in the ATF code coverage API requests \[sys_atf_code_coverage_request\] table are subject to truncation:

* test_suite_results - JSON array of test suite result IDs.
* test_results - JSON array of test result IDs.
* metadata_info - JSON object containing filtered lines or a script array.
{#atf_code_covg-POST-byScriptId__ul_pcf_xsh_m3c}

If the was_truncated property is true, details are provided in the truncation_message property of the response body. Additionally, the system logs the following message:

`Field <table_name>.<field_name> truncated from <original_length> to <truncated_length> characters (max: <max_field_length>). Consider increasing column length to prevent data loss"`  
The glide.db.truncate_utf8 system property truncation behavior:

* If glide.db.truncate_utf8 is true, the information truncates at UTF-8 byte boundaries. This setting is safer for multi-byte characters.
* If glide.db.truncate_utf8 is false (default), the information truncates at character boundaries. The default boundary is 4000 characters.
{#atf_code_covg-POST-byScriptId__ul_j11_tth_m3c}  

### cURL request

The following example shows how to retrieve the code coverage for a selected test result suite filtered by a specific test script. When verbose is `false` or omitted, the
details object is empty. Only the overall total percentage is returned.

    curl "https://instance.service-now.com/api/now/atf/code_coverage/by_script_id" \
    --request POST \
    --header "Accept:application/json" \
    --header "Content-Type:application/json" \
    --data "{
      \"test_suite_result_ids\": [\"5f81c7c4ff943210b88affffffffffc5\"],
      \"script_array\": [
        \"sys_script_include_db95cb370a0a0b2b00244880b5cacda7\",
        \"sys_script_include_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6\"
      ]
    }" \
    --user 'username':'password'

Output:

    {
      "result": "success",
      "total": 78,
      "details": {},
      "api_request_sys_id": "a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2",
      "link": "https://instance.service-now.com/sys_atf_code_coverage_request.do?sys_id=a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2"
    }

## ATF Code Coverage - POST /now/atf/code_coverage/by_line_number {#ariaid-title4}

Computes code coverage using a set of filtered line numbers per metadata record.

### URL format

Versioned URL: /api/now/v1/atf/code_coverage/by_line_number

Default URL: /api/now/atf/code_coverage/by_line_number

### Supported request parameters

{#atf_code_covg-POST-byLineNumber__entry__2}{#atf_code_covg-POST-byLineNumber__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 13. Path parameters]

{#atf_code_covg-POST-byLineNumber__entry__6}

| Name | Description |
|-|-|
| None |   |
[Table 14. Query parameters]

{#atf_code_covg-POST-byLineNumber__table_fyr_lf4_k3c__entry__2}{#atf_code_covg-POST-byLineNumber__atfCC-reqParms-filtered_lines}{#atf_code_covg-POST-byLineNumber__atfCC-reqParms-filtered_linesID}{#atf_code_covg-POST-byLineNumber__atfCC-reqParms-filtered_linesScrpt}

| Name | Description |
|-|-|
| test_suite_result_ids | Required unless `test_result_ids` are provided. List of test suite result sys_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Suite Results \[sys_atf_test_suite_result\] Data type: Array of strings |
| test_result_ids | Required unless `test_suite_result_ids` are provided. List of test result sys_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request. Table: Test Results \[sys_atf_test_result\] Data type: Array of strings |
| filtered_lines | Required. Map of metadata sys_ids and corresponding code lines to designate for code coverage (e.g., `{ "<metadata_sys_id>": { "script": [...] } }`). Data type: Object |
| filtered_lines.\<sys_id\> | Required, must not be empty. One or more script sys_ids to evaluate for code coverage. Must contain at least one valid (non-empty) script identifier. Null, empty, or whitespace-only entries are filtered out. Table: Metadata Tracing \[sys_traced_metadata\] Data type: Object |
| filtered_lines.\<sys_id\>.script | Required. List of line numbers and strings of ranges of lines numbers. All values provided must be positive integers greater than or equal to 1. Valid line number formats: * Individual lines: \[1, 7, 10\] * Ranges: For example, \["1-7"\] expands to \[1, 2, 3, 4, 5, 6, 7\]. * The format is start-end, where the value of start is less than or equal to end. * The maximum range is 10000 lines. {#atf_code_covg-POST-byLineNumber__ul_sg3_q2s_l3c} * Mixed formats. For example, \[1, "3-6", 7\] expands to \[1, 3, 4, 5, 6, 7\]. {#atf_code_covg-POST-byLineNumber__ul_n1v_5f4_k3c} Example: { "filtered_lines": { "sys_script_include_db95cb370a0a0b2b00244880b5cacda7": { "script": [1, "3-6", 7, "10-12"] } } } Data type: Array |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script. Valid values: * true: Include detailed per-item coverage in the response body details object. * false: The response body details object will return empty or not at all. {#atf_code_covg-POST-byLineNumber__ul_qm3_ycy_l3c} Default: false Data type: Boolean |
| sys_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided. Data type: Array of strings |
[Table 15. Request body parameters (JSON)]

{#atf_code_covg-POST-byLineNumber__table_fyr_lf4_k3c}

### Headers

The following request and response headers apply to this HTTP
action only, or apply to this action in a distinct way. For a list of general headers used
in the REST API, see [Supported REST API headers](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-byLineNumber__entry__26}{#atf_code_covg-POST-byLineNumber__accept-RESTAPI}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
[Table 16. Request headers]

{#atf_code_covg-POST-byLineNumber__entry__30}

| Header | Description |
|-|-|
| None |   |
[Table 17. Response headers]

### Status codes

The following status codes apply to this HTTP action. For a
list of possible status codes used in the REST API, see [REST API HTTP response
codes](https://servicenow-prod.fluidtopics.net/qh7RcF0RI6a~i9u3octdlg "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#atf_code_covg-POST-byLineNumber__entry__34}{#atf_code_covg-POST-byLineNumber__entry-200-status-code}{#atf_code_covg-POST-byLineNumber__entry-400-status-code}{#atf_code_covg-POST-byLineNumber__entry-500-status-code}

| Status code | Description |
|-|-|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
[Table 18. Status codes]

### Response body parameters (JSON) {#atf_code_covg-POST-byLineNumber__section_wkx_2qx_l3c}

{#atf_code_covg-POST-byLineNumber__table_10z_n1c_i8e__entry__2}

| Name | Description |
|-|-|
| link | Link to the request record. Data type: String |
| details.\<scriptId\> | Lists the ATF aggregation coverage percent of each custom test script by script sys_id. Data type: Number |
| api_request_sys_id | The sys_id of the request. Table: ATF code coverage API requests \[sys_atf_code_coverage_request\] Data type: String |
| result | Success or error message. Error response formats: * 400 Bad Request`{ "result": "Validation error: <specific_error_message>" }` * 500 Internal Server Error`{ "result": "Internal server error: <error_message>" }` {#atf_code_covg-POST-byLineNumber__ul_apt_1ss_l3c} Possible errors: * Filtered lines validation - `"filtered_lines is required and cannot be empty" - "filtered_lines must contain at least one metadata entry with valid line numbers"` * Filtered lines structure errors: * `"Invalid line number format in filtered_lines: <details>"` * `"Invalid data type in filtered_lines: Ensure line numbers are integers or valid range strings (e.g., '1-7')"` * `"Null value found in filtered_lines structure. All metadata IDs, field names, and line number lists must be non-null"` * `"Unexpected error processing filtered_lines: <exception_type>: <message>"` {#atf_code_covg-POST-byLineNumber__ul_zkv_yqh_m3c} * Line number format errors: * Generic parsing failure - `"Invalid line number format: <item>"` - * Line number \< 1 - `"Line number must be positive: <line_number>"` * Line range selection error, such as "a-b" - `"Invalid range format: <range>. Both start and end must be valid integers"` * Line range selection error, such as "10-5" - `"Invalid range: <range>. Start value (<start>) must be less than or equal to end value (<end>)"` * Line range selection error, such as "-5-10" - `"Invalid range: <range>. Line numbers must be positive (start: <start>)"` * Line range selection error, such as "1-50000" - `"Range too large: <range>. Maximum range size is 10000 lines (requested: <size>)"` {#atf_code_covg-POST-byLineNumber__ul_klw_1sh_m3c} * Request body validation - `Request body is required and cannot be empty` * Test ID validation - `At least one valid (non-empty) ID must be provided in either test_result_ids or test_suite_result_ids` * Type mismatch - `Invalid data type in request parameters` {#atf_code_covg-POST-byLineNumber__ul_qzs_kts_l3c} Data type: String |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the details property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided. Possible values: 0-100 Data type: Number |
| truncation_message | If request data was truncated during persistence, provides details about what scripts have truncated information. Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using glide.db.truncate_utf8 system property as described in the Additional information section. Valid values: * true: Request data was truncated during persistence. * false: Request data was not truncated during persistence. {#atf_code_covg-POST-byLineNumber__ul_ihd_rdy_l3c} Data type: Boolean Default number of characters: 4000 |
[ ]

{#atf_code_covg-POST-byLineNumber__table_10z_n1c_i8e}

### Additional information {#atf_code_covg-POST-byLineNumber__id_lvt_1qx_l3c}

Large request payloads may be truncated when persisted if the request data exceeds database field limits.  
The following fields in the ATF code coverage API requests \[sys_atf_code_coverage_request\] table are subject to truncation:

* test_suite_results - JSON array of test suite result IDs.
* test_results - JSON array of test result IDs.
* metadata_info - JSON object containing filtered lines or a script array.
{#atf_code_covg-POST-byLineNumber__ul_pcf_xsh_m3c}

If the was_truncated property is true, details are provided in the truncation_message property of the response body. Additionally, the system logs the following message:

`Field <table_name>.<field_name> truncated from <original_length> to <truncated_length> characters (max: <max_field_length>). Consider increasing column length to prevent data loss"`  
The glide.db.truncate_utf8 system property truncation behavior:

* If glide.db.truncate_utf8 is true, the information truncates at UTF-8 byte boundaries. This setting is safer for multi-byte characters.
* If glide.db.truncate_utf8 is false (default), the information truncates at character boundaries. The default boundary is 4000 characters.
{#atf_code_covg-POST-byLineNumber__ul_j11_tth_m3c}  

### cURL request

The following example shows how to retrieve all code coverage for a selected test result suite and test result.

    curl "https://instance.service-now.com/api/now/atf/code_coverage/by_line_number" \
    --request POST \
    --header "Accept:application/json" \
    --header "Content-Type:application/json" \
    --data "{
      \"test_suite_result_ids\": [\"5f81c7c4ff943210b88affffffffffc5\"],
      \"test_result_ids\": [\"bb8daec1ff103210b88affffffffff1c\"],
      \"filtered_lines\": {
        \"sys_script_include_db95cb370a0a0b2b00244880b5cacda7\": {
          \"script\": [1, \"3-6\", 7, \"10-12\"]
        }
      },
      \"verbose\": true,
      \"sys_scopes\": [\"x_my_app\", \"global\"]
    }" \
    --user 'username':'password'

Output:

    {
      "result": "success",z
      "total": 64,
      "details": {
        "sys_script_include_db95cb370a0a0b2b00244880b5cacda7": 80,
        "sys_ui_script_c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8": 50
      },
      "api_request_sys_id": "b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3",
      "link": "https://instance.service-now.com/sys_atf_code_coverage_request.do?sys_id=b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3",
      "was_truncated": false
    }


