You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:使用ALM Rest API获取测试运行关联缺陷

Hey there! Let's work through this issue and get you the linked defects for your test run via REST API properly.

Fixing the Bad Request Error & Fetching Test Run Linked Defects

First, let's break down why you're getting that Bad Request error, then walk through the correct approach.

Common Causes of Your Bad Request

  • Invalid path syntax: The ../defects//defect-links endpoint you tried has a double slash // — that's an invalid URL path right off the bat, which will trigger a 400 error. Fix that to a single slash first, but even then, this might not be the right endpoint for your goal.
  • Wrong endpoint choice: To get defects linked to a test run, you shouldn't start from the defects endpoint. Most test management tools (like TestRail, which uses a common API pattern) tie linked defects directly to the test run resource.

Correct API Workflow (Typical Test Management Tool Example)

Here's how you should structure your request to fetch linked defects for a test run:

  1. Grab your target test run ID: First, make sure you have the unique ID of the test run you're investigating (e.g., 456).
  2. Call the test run-specific defects endpoint:
    • The standard GET endpoint usually looks like this: GET ../test_runs/{run_id}/defects or GET ../test_runs/{run_id}/defect_links (exact path depends on your tool's API specs).
    • Example cURL request to test this:
      curl -X GET "https://your-tool-domain/api/v2/test_runs/456/defects" \
      -H "Authorization: Basic your-base64-encoded-auth" \
      -H "Content-Type: application/json"
      

If You Still Get a Bad Request, Check These

  • Authentication is valid: Double-check that your API key, auth token, or Basic Auth header is correctly formatted and has the right permissions. A lot of 400 errors hide authentication issues.
  • Required parameters aren't missing: Some APIs require pagination params (like limit or offset) or other filters. If any mandatory query params are absent, you'll get a Bad Request.
  • API version matches: Ensure your endpoint path aligns with the version of the API your tool is running — older/newer versions might have changed the endpoint structure.

If you were set on using a defect-links style endpoint, that's typically for fetching links for a single defect (e.g., ../defects/{defect_id}/links), not for pulling all defects linked to a test run. So that's probably not the right fit for what you're trying to do.

内容的提问来源于stack exchange,提问作者Tharun Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:37:37