### Get TestStep API Request Example Source: https://zephyrsquad.docs.apiary.io/reference/teststep/get-update-and-delete-teststep/get-teststep This example demonstrates how to make a GET request to retrieve a specific test step using its issue ID, test step ID, and project ID. Ensure you provide valid IDs for accurate results. ```bash GET https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/teststep/issueId/id?projectId= ``` -------------------------------- ### Get Step Defects by Execution (Java) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Example of fetching step defects using Java with the `HttpClient`. This code requires proper setup of the HTTP client and handling of the response. ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetStepDefects { public static void main(String[] args) throws Exception { String executionId = ""; String projectId = ""; String jwtToken = ""; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId=" + executionId + "&projectId=" + projectId)) .header("Authorization", "JWT " + jwtToken) .header("Content-Type", "application/json") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println("Status Code: " + response.statusCode()); System.out.println("Response Body: " + response.body()); } } ``` -------------------------------- ### Get Step Defects by Execution (Objective-C) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Objective-C example using `NSURLSession` to perform the GET request. This code snippet shows how to handle the network request and response. ```objectivec #import int main(int argc, const char * argv[]) { @autoreleasepool { NSString *executionId = @""; NSString *projectId = @""; NSString *jwtToken = @""; NSString *urlString = [NSString stringWithFormat:@"https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId=%@&projectId=%@", executionId, projectId]; NSURL *url = [NSURL URLWithString:urlString]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; request.HTTPMethod = @"GET"; [request setValue:[NSString stringWithFormat:@"JWT %@", jwtToken] forHTTPHeaderField:@"Authorization"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"Error: %@\n", error.localizedDescription); } else { NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; NSLog(@"Status Code: %ld\n", (long)httpResponse.statusCode); NSLog(@"Response Body: %@\n", responseString); } }]; [dataTask resume]; // Keep the main thread alive to allow the network request to complete CFRunLoopRun(); } return 0; } ``` -------------------------------- ### cURL Request Example Source: https://zephyrsquad.docs.apiary.io/reference/execution/get-execution-summary-of-the-issues-by-sprint/get-execution-summary-of-the-issues-by-sprint Example of how to call the API endpoint using cURL to get the execution summary for issues in a sprint. ```bash curl -X POST \ https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executions/search/sprint/sprintId/issues \ -H 'Content-Type: application/json' \ -H 'Authorization: JWT eyJhbGciOiJIUzI1NiI...' \ -H 'zapiAccessKey: amlyYTo3YjU3OTBhN...' \ -d '{ "issueIdOrKeys":"12800,13821" }' ``` -------------------------------- ### Get Execution Count Go Example Source: https://zephyrsquad.docs.apiary.io/reference/report/get-execution-count/get-execution-count This Go program shows how to make a GET request to the execution count API. It includes setting the necessary headers for authentication and handling the response. ```Go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executioncount?groupFld=&versionId=&cycleId=&periodName=&projectId=&folderId=" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") req.Header.Add("zapiAccessKey", "amlyYTo3YjU3OTBhN...") res, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get StepResult Attachment List Request Example Source: https://zephyrsquad.docs.apiary.io/reference/attachment/get-stepresult-attachment-list/get-stepresult-attachment-list This example demonstrates how to construct a request to retrieve a list of attachments for a given step result. Ensure you provide valid projectId and issueId. ```HTTP POST https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/attachment/search/stepresult?projectId=&issueId= stepResultId=0001484157590227-242ac112-0001&stepResultId=0001484157590200-242ac112-0001 ``` -------------------------------- ### Get List of Executions - Java Example Source: https://zephyrsquad.docs.apiary.io/reference/execution/get-list-of-executions/get-list-of-executions This Java code snippet demonstrates how to call the API to get a list of executions. It includes setting up the request body and headers. ```java String url = "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executions/search?executionId="; String jsonBody = "{\"maxRecords\":20,\"offset\":0,\"zql\":\"field = \\\"value\\\"\"}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "application/json") .header("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") .header("zapiAccessKey", "amlyYTo3YjU3OTBhN...") .POST(HttpRequest.BodyPublishers.ofString(jsonBody)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` -------------------------------- ### Get Step Defects by Execution (Ruby) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Ruby example using the `net/http` library to make the API request. This demonstrates setting headers and handling the response. ```ruby require 'net/http' require 'uri' require 'json' execution_id = '' project_id = '' jwt_token = '' uri = URI.parse("https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId=#{execution_id}&projectId=#{project_id}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) request['Authorization'] = "JWT #{jwt_token}" request['Content-Type'] = 'application/json' response = http.request(request) puts "Status Code: #{response.code}" puts "Response Body: #{response.body}" ``` -------------------------------- ### Get ZQL Filters by Criteria - Swift Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Swift, demonstrating request setup with headers. ```Swift import Foundation func getZqlFilters() { guard let url = URL(string: "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=") else { return } var request = URLRequest(url: url) request.httpMethod = "GET" request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.setValue("JWT eyJhbGciOiJIUzI1NiI...", forHTTPHeaderField: "Authorization") request.setValue("amlyYTo3YjU3OTBhN...", forHTTPHeaderField: "zapiAccessKey") let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error.localizedDescription)\n") return } guard let data = data else { return } if let responseString = String(data: data, encoding: .utf8) { print("Response: \(responseString)\n") } } task.resume() } getZqlFilters() ``` -------------------------------- ### Get ZQL Filters by Criteria - Objective-C Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Objective-C, demonstrating request setup with headers. ```Objective-C #import int main(int argc, const char * argv[]) { @autoreleasepool { NSURL *url = [NSURL URLWithString:@"https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser="]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"GET"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setValue:@"JWT eyJhbGciOiJIUzI1NiI..." forHTTPHeaderField:@"Authorization"]; [request setValue:@"amlyYTo3YjU3OTBhN..." forHTTPHeaderField:@"zapiAccessKey"]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"Error: %@\n", error.localizedDescription); } else { NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"Response: %@\n", responseString); } }]; [task resume]; } return 0; } ``` -------------------------------- ### Get ZQL Filters by Criteria - Groovy Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Groovy, demonstrating request setup with headers. ```Groovy import groovy.json.JsonSlurper def url = 'https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=' def headers = [ 'Content-Type': 'application/json', 'Authorization': 'JWT eyJhbGciOiJIUzI1NiI...', 'zapiAccessKey': 'amlyYTo3YjU3OTBhN...' ] def client = new HTTPBuilder(url) client.headers.'Content-Type' = 'application/json' client.headers.'Authorization' = 'JWT eyJhbGciOiJIUzI1NiI...' client.headers.'zapiAccessKey' = 'amlyYTo3YjU3OTBhN...' client.get(contentType: groovy.json.JsonOutput.toJson(headers)) { resp, reader -> assert resp.status == 200 println reader.text } ``` -------------------------------- ### Add Tests to Folder Go Example Source: https://zephyrsquad.docs.apiary.io/reference/execution/add-tests-to-folder/add-tests-to-folder This Go code snippet demonstrates how to send a POST request to add tests to a folder using the standard 'net/http' package. It includes setting headers and the JSON payload. ```go package main import ( "bytes" "fmt" "net/http" "io/ioutil" ) func main() { url := "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executions/add/folder/folderId" payload := []byte(`{ "issues": ["FSC-2", "FSC-3"], "assigneeType": "currentUser", "method": 1, "versionId": 12829, "projectId": 10930, "cycleId": "0001513838430954-242ac112-0001" }`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload)) if err != nil { panic(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") req.Header.Set("zapiAccessKey", "amlyYTo3YjU3OTBhN...") client := &http.Client{} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` -------------------------------- ### Get List of Executions - Go Example Source: https://zephyrsquad.docs.apiary.io/reference/execution/get-list-of-executions/get-list-of-executions This Go code snippet demonstrates how to retrieve a list of executions via the API. It includes setting up the HTTP client, request, and handling the response. ```go package main import ( "bytes" "fmt" "net/http" "io/ioutil" ) func main() { url := "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executions/search?executionId=" requestBody := []byte(`{ "maxRecords": 20, "offset": 0, "zql": "field = \"value\"" }`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody)) if err != nil { fmt.Printf("Error creating request: %s\n", err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") req.Header.Set("zapiAccessKey", "amlyYTo3YjU3OTBhN...") client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Printf("Error sending request: %s\n", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Printf("Error reading response body: %s\n", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get ZQL Filters by Criteria - C# Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using C#, demonstrating request setup with headers. ```C# using System; using System.Net.Http; using System.Threading.Tasks; public class GetZqlFilters { public static async Task Main(string[] args) { using (var client = new HttpClient()) { var url = "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser="; var request = new HttpRequestMessage(HttpMethod.Get, url); request.Headers.Add("Content-Type", "application/json"); request.Headers.Add("Authorization", "JWT eyJhbGciOiJIUzI1NiI..."); request.Headers.Add("zapiAccessKey", "amlyYTo3YjU3OTBhN..."); try { var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); // Throw if HTTP status code is not 2xx var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Request error: {e.Message}"); } } } } ``` -------------------------------- ### Get ZQL Filters by Criteria - Go Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Go, demonstrating request setup with headers. ```Go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { url := "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") req.Header.Add("zapiAccessKey", "amlyYTo3YjU3OTBhN...") resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get Step Defects by Execution (Go) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Go language example for fetching step defects. This code snippet shows how to construct the request and process the response. ```go package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func main() { executionID := "" projectID := "" jwtToken := "" url := fmt.Sprintf("https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId=%s&projectId=%s", executionID, projectID) client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Authorization", "JWT "+jwtToken) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Status Code:", res.StatusCode) fmt.Println("Response Body:", string(body)) } ``` -------------------------------- ### Get ZQL Filters by Criteria - Ruby Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Ruby, demonstrating request setup with headers. ```Ruby require 'net/http' require 'uri' uri = URI.parse('https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=') request = Net::HTTP::Get.new(uri) request['Content-Type'] = 'application/json' request['Authorization'] = 'JWT eyJhbGciOiJIUzI1NiI...' request['zapiAccessKey'] = 'amlyYTo3YjU3OTBhN...' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(request) end puts response.body ``` -------------------------------- ### Get Step Defects by Execution (Visual Basic) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Visual Basic example using `HttpClient` to fetch step defects. This code snippet shows how to make the HTTP request and display the response. ```vbnet Imports System.Net.Http Imports System.Threading.Tasks Public Module GetStepDefects Public Async Function Main() As Task Dim executionId As String = "" Dim projectId As String = "" Dim jwtToken As String = "" Using client As New HttpClient() Dim url As String = $"https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId={executionId}&projectId={projectId}" client.DefaultRequestHeaders.Add("Authorization", $"JWT {jwtToken}") client.DefaultRequestHeaders.Add("Content-Type", "application/json") Dim response As HttpResponseMessage = Await client.GetAsync(url) Dim responseBody As String = Await response.Content.ReadAsStringAsync() Console.WriteLine($"Status Code: {(Integer)response.StatusCode}") Console.WriteLine($"Response Body: {responseBody}") End Using End Function End Module ``` -------------------------------- ### Get ZQL Filters by Criteria - Java Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Java, demonstrating request setup with headers. ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetZqlFilters { public static void main(String[] args) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=")) .header("Content-Type", "application/json") .header("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") .header("zapiAccessKey", "amlyYTo3YjU3OTBhN...") .GET() .build(); try { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } } ``` -------------------------------- ### Get ZQL Filters by Criteria - Visual Basic Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Visual Basic, demonstrating request setup with headers. ```Visual Basic Imports System Imports System.Net.Http Imports System.Threading.Tasks Public Module GetZqlFilters Public Async Function Main() As Task Using client As New HttpClient() Dim url As String = "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=" Dim request As New HttpRequestMessage(HttpMethod.Get, url) request.Headers.Add("Content-Type", "application/json") request.Headers.Add("Authorization", "JWT eyJhbGciOiJIUzI1NiI...") request.Headers.Add("zapiAccessKey", "amlyYTo3YjU3OTBhN...") Try Dim response As HttpResponseMessage = Await client.SendAsync(request) response.EnsureSuccessStatusCode() Dim responseBody As String = Await response.Content.ReadAsStringAsync() Console.WriteLine(responseBody) Catch ex As HttpRequestException Console.WriteLine($"Request error: {ex.Message}") End Try End Using End Function End Module ``` -------------------------------- ### Add Tests to Folder JavaScript Example Source: https://zephyrsquad.docs.apiary.io/reference/execution/add-tests-to-folder/add-tests-to-folder This JavaScript example uses the fetch API to send a POST request to add tests to a folder. It demonstrates setting the request method, headers, and body. ```javascript const myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "JWT eyJhbGciOiJIUzI1NiI..."); myHeaders.append("zapiAccessKey", "amlyYTo3YjU3OTBhN..."); const raw = JSON.stringify({ "issues": [ "FSC-2", "FSC-3" ], "assigneeType": "currentUser", "method": 1, "versionId": 12829, "projectId": 10930, "cycleId": "0001513838430954-242ac112-0001" }); const requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executions/add/folder/folderId", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.error('error', error)); ``` -------------------------------- ### Get Step Defects by Execution (C#) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution C# example using `HttpClient` to retrieve step defects. This code demonstrates asynchronous request handling and response processing. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; public class GetStepDefects { public static async Task Main(string[] args) { string executionId = ""; string projectId = ""; string jwtToken = ""; using (HttpClient client = new HttpClient()) { string url = $"https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId={executionId}&projectId={projectId}"; client.DefaultRequestHeaders.Add("Authorization", $"JWT {jwtToken}"); client.DefaultRequestHeaders.Add("Content-Type", "application/json"); HttpResponseMessage response = await client.GetAsync(url); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine($"Status Code: {(int)response.StatusCode}"); Console.WriteLine($"Response Body: {responseBody}"); } } } ``` -------------------------------- ### Get Execution Count Node.js Example Source: https://zephyrsquad.docs.apiary.io/reference/report/get-execution-count/get-execution-count This Node.js example shows how to make a GET request to the execution count API. It utilizes the 'request' library to handle the HTTP call and includes authentication headers. ```Node.js const request = require('request'); const options = { method: 'GET', url: 'https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/executioncount?groupFld=&versionId=&cycleId=&periodName=&projectId=&folderId=', headers: { 'Content-Type': 'application/json', 'Authorization': 'JWT eyJhbGciOiJIUzI1NiI...', 'zapiAccessKey': 'amlyYTo3YjU3OTBhN...' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Get Step Defects by Execution (PHP) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution PHP example using cURL to fetch step defects. This snippet shows how to set up the cURL request and handle the response. ```php '; $projectId = ''; $jwtToken = ''; $url = "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId={$executionId}&projectId={$projectId}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Authorization: JWT {$jwtToken}", "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $result; } curl_close($ch); ?> ``` -------------------------------- ### Get addon info Source: https://zephyrsquad.docs.apiary.io/reference/folder/folder-update/create-api Retrieves information about the installed addon. ```APIDOC ## Get addon info ### Description Returns information about the installed addon. ### Method GET ### Endpoint /api/v1/license/addon ``` -------------------------------- ### Get All TestSteps Response Example Source: https://zephyrsquad.docs.apiary.io/reference/teststep/get-all-teststeps-latest/get-all-teststeps-latest This is an example of the JSON response structure when retrieving all test steps. It includes details for each test step such as ID, order, issue ID, step description, data, creator, and timestamps. ```json { "testSteps": [ { "id": "002b456d-1a68-4dc1-ba3a-6b3afba600cc", "orderId": 1, "issueId": 10073, "step": "Verify Final Build", "data": "Verify Final Build", "result": "Verify Final Build", "createdBy": "admin", "createdByAccountId": "557058:01b3a732-1bdb-444a-84bb-bcaa9882a91d", "createdOn": 1544984243831, "lastModifiedOn": 1544984243831, "customFieldValues": [ { "customFieldId": "40640271-5d33-4c05-af36-3057e128d55a", "value": { "value": "" }, "fieldType": "DATE_TIME", "disabled": null } ], "attachments": [] }, { "id": "5ec00070-959c-4a2c-82b8-af1f85ec241f", "orderId": 2, "issueId": 10073, "step": "Verify Launch Sequences", "data": "Verify Launch Sequence", "result": "Verify Launch Sequence", "createdBy": "admin", "createdByAccountId": "557058:01b3a732-1bdb-444a-84bb-bcaa9882a91d", "modifiedBy": "admin", "modifiedByAccountId": "557058:01b3a732-1bdb-444a-84bb-bcaa9882a91d", "createdOn": 1544984276580, "lastModifiedOn": 1544995900663, "customFieldValues": [ { "customFieldId": "64194653-9c42-483b-b306-16cf56e70abe", "value": { "value": [ "Pass" ] }, "fieldType": "MULTI_SELECT", "disabled": null }, { "customFieldId": "40640271-5d33-4c05-af36-3057e128d55a", "value": { "value": "12/19/2018 04:00:00" }, "fieldType": "DATE_TIME", "disabled": null } ], "attachments": [] } ], "totalCount": 2 } ``` -------------------------------- ### Get Step Defects by Execution (Swift) Source: https://zephyrsquad.docs.apiary.io/reference/stepresult/get-stepdefects-by-execution/get-stepdefects-by-execution Swift example using `URLSession` to fetch step defects. This code demonstrates making the network request and handling the response data. ```swift import Foundation func getStepDefects() { let executionId = "" let projectId = "" let jwtToken = "" guard let url = URL(string: "https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/stepdefect/byexecution?executionId=\(executionId)&projectId=\(projectId)") else { return } var request = URLRequest(url: url) request.httpMethod = "GET" request.setValue("JWT \(jwtToken)", forHTTPHeaderField: "Authorization") request.setValue("application/json", forHTTPHeaderField: "Content-Type") let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error.localizedDescription)") return } guard let httpResponse = response as? HTTPURLResponse else { print("Invalid response") return } guard let responseData = data else { print("No data received") return } print("Status Code: \(httpResponse.statusCode)") if let responseString = String(data: responseData, encoding: .utf8) { print("Response Body: \(responseString)") } } task.resume() } getStepDefects() RunLoop.main.run() ``` -------------------------------- ### Get addon info Source: https://zephyrsquad.docs.apiary.io/reference/execution/get-execution/create-api Retrieves information about the installed add-ons. ```APIDOC ## Get addon info ### Description Returns information about the installed add-ons. ### Method GET ### Endpoint /api/v1/license/addon ``` -------------------------------- ### Get ZQL Filters by Criteria - PHP Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using PHP, showing how to set up the request with headers. ```PHP ``` -------------------------------- ### Example Response Body for Get All TestSteps V1 Source: https://zephyrsquad.docs.apiary.io/reference/teststep/create-and-get-all-teststep/get-all-teststeps-v1 This is an example of the JSON response body when successfully retrieving test steps. It includes details for each test step such as ID, order, issue ID, step description, data, creator, and timestamps. ```json [ { "id": "0001479232086830-fa312653ffffd5ee-0001", "orderId": 1, "issueId": 10200, "step": "Sample Step", "data": "Sample Step Data", "result": "Sample Expected Result", "createdBy": "admin", "createdByAccountId": "557058:01b3a732-1bdb-444a-84bb-bcaa9882a91d", "modifiedBy": "admin", "modifiedByAccountId": "557058:01b3a732-1bdb-444a-84bb-bcaa9882a91d", "createdOn": 1479232086830, "lastModifiedOn": 1479232292243 } ] ``` -------------------------------- ### Get ZQL Filters by Criteria - Python Example Source: https://zephyrsquad.docs.apiary.io/reference/zqlfilter/get-zql-filters-by-criteria/get-zql-filters-by-criteria Example of how to fetch ZQL filters using Python, showing how to set up the request with headers. ```Python import requests url = 'https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/zql/filters?maxRecords=&offset=&fav=&byUser=' headers = { 'Content-Type': 'application/json', 'Authorization': 'JWT eyJhbGciOiJIUzI1NiI...', 'zapiAccessKey': 'amlyYTo3YjU3OTBhN...' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error: {response.status_code}') ```