Forum Discussion

FNEI's avatar
FNEI
New Member
4 months ago

Error: createTestCaseIssueLink.issueId: must not be null

I am sending this, which I suspect should work to our Zephyr API  : {'project_key': None, 'list_projects': None, 'test_case_key': None, 'list_test_cases_query': None, 'get_test_cases_for_cycle_key': None, 'get_test_steps_for_case_key': None, 'create_test_case_name': None, 'update_test_case_key': None, 'update_test_case_name': None, 'update_test_case_objective': None, 'update_traceability_link_key': None, 'delete_test_case_key': None, 'create_test_steps_for_case_key': None, 'create_test_steps': None, 'create_test_steps_mode': 'OVERWRITE', 'add_jira_issue_link_to_test_case_key': 'SOF-T84', 'jira_issue_key_to_link': 'SOF-302', 'test_cycle_key': None, 'list_test_cycles_query': None, 'get_test_cycles_for_plan_key': None, 'create_test_cycle_name': None, 'update_test_cycle_key': None, 'update_test_cycle_name': None, 'delete_test_cycle_key': None, 'add_test_cases_to_cycle_key': None, 'test_case_keys_to_add': None, 'test_plan_key': None, 'list_test_plans_query': None, 'execution_id': None, 'list_test_executions_query': None, 'create_execution_test_case_key': None, 'create_execution_test_cycle_key': None, 'create_execution_status': None, 'update_execution_id': None, 'update_execution_status': None, 'delete_execution_id': None, 'return_raw': False}

and receive this error {"message":"createTestCaseIssueLink.issueId: must not be null"} 

Which is strange because I send in this case 2 links to existing Jira issues: 'SOF-T84' and 'SOF-302'

Anyone have an idea?

1 Reply

  • (Not sure why this is under API Hub, but...)

    I think the issue is that you’re sending issue keys; the API wants the numeric Jira issue ID.

    For Zephyr Scale the endpoint to link a Jira issue to a test case is:

    POST /v2/testcases/{testCaseKey}/issuelinks Body: { "issueId": <numeric Jira issue id> }

    Passing keys like SOF-302 or SOF-T84 will throw exactly what you’re seeing:
    createTestCaseIssueLink.issueId: must not be null. community.smartbear.com+1

    Fix

    1. Resolve the Jira issueId from the key:→ returns {"id":"10001", ...}. Use that id in the Zephyr call. (Server/DC uses /rest/api/2/..., same idea.)

    GET /rest/api/3/issue/SOF-302?fields=id

    1. Call Zephyr Scale:(Body must be issueId, not key.)

    curl -X POST \ -H "Authorization: Bearer <zephyr-scale-token>" \
     -H "Content-Type: application/json" \
     "https://api.zephyrscale.smartbear.com/v2/testcases/SOF-T84/issuelinks" \
     -d '{ "issueId": 10001 }'

    Let me know how it goes!