How to get IDs

Applies to Zephyr Squad Server 9.0.1 and 4.8, last modified on September 19, 2022

You will need item IDs to work with them using the Zephyr Squad API. You can get them by using the Jira API, the Zephyr API, or the Jira UI.

Project ID

A project ID is an integer number that identifies the project in Jira API operations. It differs from the project key which is a string and is visible in issue keys (for example, in the PROJ-123 issue key, the PROJ substring is the project key).

You can find the project ID in the Jira UI, or you can get it through API calls.

You can find the project ID in the Jira user interface:

  1. Go to  Administration > Projects, click the needed project:

    Project ID

    Click the image to enlarge it.

  2. On the subsequent page, click Details.

    The project ID will be at end of the URL of the project details page .

You can use the Jira Server REST API to get the project ID by the project key.

While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/api/latest/project/PROJ

Look for the id in the response:

{
  "expand":"description,lead,url,projectKeys",
  "self":"<SERVER-BASE-URL>/rest/api/2/project/10600",
  "id":"10600",
  "key":"PROJ",
  "description":"",
...
}

Version ID

Each Jira project can have several versions (or releases). Some Zephyr API operations require a version ID. You can find this ID in the Jira UI, or you can get it through the Jira or Zephyr Squad API.

You can find the version ID in the user interface:

  1. Go to Projects, click the needed project (or select one from the View All Projects menu):

    Version ID

    Click the image to enlarge it.

  2. On the subsequent page, click Releases.

  3. On the Releases page, hover over the name of the needed version.

    The version ID will be at the end of the URL that is shown in the bottom-left corner of the browser window.

You can use the Jira Server REST API to get all versions of the project by the project key or project ID.

While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/api/latest/project/PROJ/versions

Look for the id in the response:

[
  ...
  {
  "self":"<SERVER-BASE-URL>/rest/api/2/version/11700",
    "id":"11700",
    "name":"TestVersion1",
    "archived":false,
    "released":false,
    "projectId":10600
  },
  ...
]

You can use the Zephyr Server REST API to get all versions of the project by the project ID.

While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/zapi/latest/util/versionBoard-list?projectId=10600

Look for the value in the returned data:

{
  "type":"software",
  "hasAccessToSoftware":"true",
  "unreleasedVersions":[
    {
      "value":"-1",
      "archived":false,
      "label":"Unscheduled"
    },
    {
      "value":"11700",
      "archived":false,
      "label":"TestVersion1"
    }
  ],
  "releasedVersions":[]
}

Issue (Test) ID

An issue ID is an integer number that identifies a Jira item in API operations. It differs from the issue key which is a string visible to users (like PROJ-123).

A Zephyr test (or test case) is a Jira item of the Test type. You can find its ID in the Jira UI, or you can get it through the API.

You can find the issue (test) ID in the user interface:

  • Go to Tests > Search Tests:

    Test ID

    Click the image to enlarge it.

  • On the subsequent page, find the needed test case and hover over the  Edit button.

    The test ID is at the end of the URL that is shown in the bottom-left corner of the browser window.

Option 1

If you created an issue (test) via API, you can find the ID in the response to the appropriate API request. See Create Tests – Response.

Option 2

You can use the Jira Server REST API to get the issue ID by the issue key.

While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/api/latest/issue/ABC-123?fields=id

Look for the id in the response:

{
  "expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
  "id":"12042",
  "self":"<SERVER-BASE-URL>/rest/api/2/issue/12042",
  "key":"ABC-123"
}

Test Step ID

You can get the test step ID through API calls.

If you created a test step with the Zephyr API, you can find the step ID in the response to the request that created the step. See Add Steps to Tests – Response.

To get the ID of an arbitrary test step, you can use the Zephyr Server REST API. While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/zapi/latest/teststep/24607

This operation will return information on all test steps of a test by this test’s ID.

Look for the id in the returned data:

{
  "stepBeanCollection":[
    {
      "id":12370,
      "orderId":1,
      "step":"First step",
      "data":"This is the first step",
      "result":"",
      "createdBy":"",
      "modifiedBy":"",
      "htmlStep":"<p>First step</p>",
      "htmlData":"<p>This is the first step</p>",
      "htmlResult":"",
      "attachmentsMap":[],
      "customFields":{},
      "totalStepCount":2,
      "customFieldValuesMap":{}
    },
    {
      "id":12371,
      "orderId":2,
      "step":"Second step",
      "data":"This is the second step",
      "result":"",
      "createdBy":"",
      "modifiedBy":"",
      "htmlStep":"<p>Second step</p>",
      "htmlData":"<p>This is the second step</p>",
      "htmlResult":"",
      "attachmentsMap":[],
      "customFields":{},
      "totalStepCount":2,
      "customFieldValuesMap":{}
    }
  ]
}

Note: The test steps IDs are the same for all test executions.

Test Cycle ID

You can find the test cycle ID from the Jira UI. You can also get it through the API.

You can find the cycle ID in the user interface:

  1. Go to Tests > Plan Test Cycle:

    Cycle ID

    Click the image to enlarge it.

  2. On the Cycle Summary page, click the needed cycle. You must have at least one test case in the cycle.

  3. Hover over the Execute button in the Actions column of the test cases table.

  4. Look for the cycledId in the URL that is shown on the bottom of the browser window.

Option 1

If you created a test cycle with the Zephyr API, you can find the cycle ID in the response to the request that created that cycle. See Create Cycles – Response.

Option 2

You can use a special operation of the Zephyr Server REST API to get all cycles by the project and version IDs. While logged in to Jira, paste the following into the browser address bar replacing the highlighted values with yours:

<SERVER-BASE-URL>/rest/zapi/latest/cycle?projectId=10200&versionId=10900

Look for the ID in the response data:

{
  "-1":{
    "totalExecutions":0,
    "endDate":"",
    "description":"",
    "totalExecuted":0,
    "started":"",
    "versionName":"Demo version",
    "cycleOrderId":null,
    "isExecutionWorkflowEnabledForProject":true,
    "expand":"executionSummaries",
    "projectKey":"PROJ",
    "versionId":10900,
    "environment":"",
    "createdDate":"",
    "totalCycleExecutions":0,
    "isTimeTrackingEnabled":true,
    "build":"",
    "ended":"",
    "name":"Ad hoc",
    "projectName":"DemoProject",
    "projectId":10200,
    "startDate":"",
    "executionSummaries":{
      "executionSummary":[]
    }
  },
  "182":{
    "totalExecutions":0,
    "endDate":"",
    "description":"",
    "versionName":"Demo version",
    "modifiedByDisplay":"admin",
    "sortQuery":"OrderId:ASC",
    "projectKey":"PROJ",
    "totalDefects":0,
    "isTimeTrackingEnabled":true,
    "action":"expand",
    "modifiedBy":"admin",
    "executionSummaries":{
      "executionSummary":[]
    },
    "soffset":"0",
    "totalExecuted":0,
    "started":"",
    "cycleOrderId":1,
    "isExecutionWorkflowEnabledForProject":true,
    "expand":"executionSummaries",
    "versionId":10900,
    "environment":"",
    "createdDate":"",
    "totalCycleExecutions":1,
    "build":"",
    "createdBy":"admin",
    "ended":"",
    "name":"My-Cycle",
    "totalFolders":1,
    "projectName":"DemoProject",
    "projectId":10200,
    "createdByDisplay":"admin",
    "startDate":""
  },
  "recordsCount":2
}

Tip: Search for the name of the cycle whose ID you are looking for. You will find the needed cycle ID before the cycle name and totalExecutions properties.

Folder ID

You can get the folder ID through API calls.

If you created a folder with the Zephyr API, you can find its ID in the response to the request that created that folder. See Add Folders to Cycles – Response.

You can use a special Zephyr Server REST API operation to get all folders of the cycle by the project, version, and cycle IDs. Log in to Jira, and then paste the following into the browser address bar (replace the highlighted values with yours):

<SERVER-BASE-URL>/rest/zapi/latest/cycle/182/folders?projectId=10200&versionId=10900

Look for the folderId in the response data:

[
  {"folderId":384,
  "folderName":"My-Folder",
  "folderDescription":"",
  "cycleId":182,
  "cycleName":"My-Cycle",
  "projectId":10200,
  "projectKey":"PROJ",
  "projectName":"DemoProject",
  "versionName":"Demo version",
  "versionId":10900,
  "folderOrderId":1,
  ...
  }
]

Test Execution ID

A test execution is a test instance in some cycle or folder. You can find the test execution ID in the Jira UI, or you can get it through the API.

You can find the cycle ID in the Jira user interface:

  1. Go to Tests > Plan Test Cycle:

    Execution ID

    Click the image to enlarge it.

  2. On the Cycle Summary page, click the needed cycle or folder.

  3. Hover over the Execute button in the Actions column of the test cases grid.

  4. Look for the ID in the URL in the bottom of the browser window after the # (hash) sign.

Option 1

If you added a test to a cycle through the API, you can find the test execution ID in the response to the request that added the test. See Add Tests to Cycles – Response.

Option 2

You can use a special operation of the Zephyr Server REST API to get all execution of a test case by the issue id or issue key.

Log in to your Jira and then paste the following into the browser address bar. Replace the highlighted values with yours:

<SERVER-BASE-URL>/rest/zapi/latest/traceability/executionsByTest?testIdOrKey=DEM-1

Look for the id in the response data:

{
  "executions":[
    {
      "defects":[],
      "execution":{
      "id":"14067",
      "status":"UNEXECUTED",
      "statusId":"-1",
      "testCycle":"My-Cycle"},
      "stepDefects":[]
    },
    {
      "defects":[],
      "execution":{
        "folderName":"My-Folder",
        "id":"14066",
        "status":"UNEXECUTED",
        "statusId":"-1",
        "testCycle":"My-Cycle"
      },
      "stepDefects":[]
    }
  ],
  "totalCount":2
}

See Also

Zephyr Squad Server REST API

Highlight search results