For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/code-coverage/get-code-coverage-summary-for-a-commit.md. A documentation index is available at /llms.txt.
Language
Datadog site

Get code coverage summary for a commit

POSThttps://api.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.us3.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.us5.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.datadoghq.eu/api/v2/code-coverage/commit/summaryhttps://api.ap1.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.ap2.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.uk1.datadoghq.com/api/v2/code-coverage/commit/summaryhttps://api.ddog-gov.com/api/v2/code-coverage/commit/summaryhttps://api.us2.ddog-gov.com/api/v2/code-coverage/commit/summary

Descripción general

Retrieve aggregated code coverage statistics for a specific commit in a repository. This endpoint provides overall coverage metrics as well as breakdowns by service and code owner.

The commit SHA must be a 40-character hexadecimal string (SHA-1 hash).

This endpoint requires the code_coverage_read permission.

OAuth apps require the code_coverage_read authorization scope to access this endpoint.

Solicitud

Body Data (required)

Campo
Type
Descripción
data [required]
object

Data object for commit summary request.

Respuesta

OK

Response object containing code coverage summary.

Campo
Type
Descripción
data
object

Data object for coverage summary response.

Ejemplo de código

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/code-coverage/commit/summary" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588",
      "repository_url": "https://github.com/datadog/test-service"
    },
    "type": "ci_app_coverage_commit_summary_request"
  }
}
EOF