Ask a Question

Authentificate using a Token with curl.exe using ZAPI

Occasional Contributor

Authentificate using a Token with curl.exe using ZAPI



after using the JUnit import functionality in Zephyr Squad, I have to attach some log files as evidence to the executions created by the JUnit test result upload.


Since I am not a Java developer but more the scripting guy kind, I was looking for examples how to do this in the most direct way.

I found that this is e.g. for uploading an attachment this is to send a POST message to the Jira Server using the ZAPI REST API.


On Windows you can use for example curl.exe.

E.g. curl -D- -u MyUserID -X POST -H "X-Atlassian-Token: no-check" -F "file=@test_time.txt"


Using a 20 line perl script I am able to for example, to retrieve the ids of the test executions via GET requests and then attach specific attachments as evidence to the executions. I have uploaded this script as "". The script is work in progress and only demonstrated that information can be retrieved via ZAPI API and attachments can be uploaded - nothing else.

I read that within the admin interface of the Zephyr Squad plugin it should be possible to generate an access key that can be used in scripts and can be assigned fine tunes access rights (similiar to github tokens). How can I generate these tokens? How can I use the token in curl.exe.



Best regards,


Occasional Contributor

Content of 20211018_upload_attachments_wip_pl.txt:


use strict;
use warnings;

use Term::ReadKey;
use JSON;
use Data::Dumper;

my $user = "USERID";

print "Please supply password and press enter:\n";

my $password = ReadLine(0);

chomp $password;

if ($password eq "") {
print "No password supplied. Script will exit.\n";
exit 1;

my $input_cycle = "1231233";

my $response;

$response = `curl -sS -u USERID:$password -X GET -H "X-Atlassian-Token: no-check"`;

my $decoded_json;
$decoded_json = decode_json($response);

my $hr = $decoded_json->{234234}[0];


#$response = `curl -sS -u USERID:$password -X POST -H "X-Atlassian-Token: no-check" -H "Content-Type:multipart/form-data" -F "file=\@C:\\Users\\ABC\\Desktop\\Work\\evidence.png"${last}&entityType=SCHEDULE`;

print $response;

Occasional Contributor

I like to use the the OAuth Athentification using curl. I.e. " curl -H "Authorization: OAuth <ACCESS_TOKEN>" ".


What is the most straight forward way to generate such an Access Token under Win10.

E.g. download an openssl binary run it with some parameters, Log into Zephyr webpage as admin and upload public key?


Best regards,


Occasional Contributor

We installed a newer version of Jira Squar, i.e. 6.2.4.

Wit this version PATs are supported. Each user can create one and use ist e.g. via curl:

curl -X GET -H "Authorization: Bearer <personal_access_token>" -H "Content-Type:multipart/form-data"

On windows cammandline you have to escape "&" character via "^&".



Showing results for 
Search instead for 
Did you mean: