Add Jira requirements to test cases when created via API

Hi!

Yes, it’s possible but not officially supported/documented yet. We might offer an easier way in the future to create/link JIRA issues.

For now, you’d first have to create a “workitem” and then link this workitem to the test case:

  1. Create workitems representing the Jira issue:
POST /api/v1/workitem/bulk
[
{
  "project_id": 1, // testiny project id
  "integration_id": 1, // testiny integration id
  "workitem_integration_type": "jira", // integration type ("jira" for Jira integrations)
  "workitem_api_project_id": "10000", // Jira project id as string (typical values are "100XX")
  "workitem_api_type_id": "10004" // The Jira issue type id (from Jira API)
  "workitem_api_id": "20658", // The Jira issue id (not the key)
}, 
 ...more workitems...
]

// The response is a list of created work items. Work item data (title, status, key, etc..) will be synced when opened in the Testiny app.
  1. Link workitems to test cases:
POST /api/v1/testcase/mapping/bulk/workitem?op=add_or_update
[
  // workitem_id: id of newly created work item from above
  // testcase_id: id of testiny testcase to link to
  // workitem_type: "REQUIREMENT" when linking to testcases
  { 
    "ids": {"testcase_id": 12345, "workitem_id": 37}, 
    "mapped": {"workitem_type": "REQUIREMENT" }
  },
   ...more work item links...
]

If you don’t know the JIRA project ids or the Jira issue type ids, we also offer an API to fetch that:

## Get available projects for an integration
GET /api/v1/workitem-integration/metadata?integration_id=1

## Get available workitem/issue types for a Jira project
GET /api/v1/workitem-integration/metadata?integration_id=1&workitem_project_ids=10000

I hope this is what you’re looking for.
Please let me know if you have any further questions or need anything else.

Best regards,
Hanna