Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Snippet of XRAY Rest API Test Results

I am trying to find a snippet of code on how to call the Rest API.  I already have my tests results writing to a cucumber.json file.  Now I need to upload after the test runs.  I am having trouble where to place the code.

curl -H "Content-Type: application/json" -X POST -u admin:admin --data @cucumber_output.json http://yourserver/rest/raven/1.0/import/execution/cucumber 

Or even this method 

public static void exportReportToJIRA(String username, String password, String jiraURL, String reportFilePath) {

String[] command = {"curl.exe", "-D-", "-X", "POST", "-H", "Content-Type: application/json",

"-H", "Authorization: Basic " + encodeBase64String(username + ":" + password),

"--data", "@" + reportFilePath,

jiraURL + "/rest/raven/1.0/import/execution/cucumber"

};

 

ProcessBuilder process = new ProcessBuilder(command);

Process p;

 

do {

System.out.println("\ninfo: Checking if cucumber.json file has been generated\n");

try {

Thread.sleep(1000);

} catch (InterruptedException ex) {

Thread.currentThread().interrupt();

}

} while (!fileExists(reportFilePath));

 

try {

System.out.println("\ninfo: Starting process that accepts curl POST command\n");

p = process.start();

} catch (IOException e) {

System.out.print("\nerror: Tried to execute curl command that posts json file to JIRA Xray, something went wrong\n");

e.printStackTrace();

}

}

 

Does this go in the Runner class? Or does someone have an example I can look at.

3 answers

Hi Kathi,

We need some more details, so please contact directly our support service desk: https://jira.xpand-it.com/servicedesk/customer/portal/2
We'll be glad to help.

Thank you,
The Xray team

Hi kathi we're you able to resolve this? I also having same issue. Kindly help

I needed to create an authentication key:

https://confluence.xpand-it.com/display/XRAYCLOUD/Global+Settings%3A+API+Keys

Then create a json with the client id and client service id

I saved as cloud_auth.json run the curl command below:

curl -H "Content-Type: application/json" -X POST --data @"cloud_auth.json" https://xray.cloud.xpand-it.com/api/v1/authenticate 

 

Then set the token with the variable or command

Set the token with the below command or as a variable 

set_token=”<insert the token with the params>” 

To set as variable type this: 

token=$(curl -H "Content-Type: application/json" -X POST --data @"cloud_auth.json" https://xray.cloud.xpand-it.com/api/v1/authenticate| tr -d '"') 

Run command curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token"  --data @"data.xml" https://xray.cloud.xpand-it.com/api/v1/import/execution/junit?projectKey=XTP 

This Adds new test and execution 

Like Jithin MJ likes this

copied from Atlassian site...

Hi Kathi,

cloud_auth.json - Could you please help me to figure out JSON format to store client id and secret id?

Is it something like this?

{

client_id : "",

secret_id : ""

}

 

Thanks in advance.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - April 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

317 views 3 20
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you