Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to sort or order a JSON response received from XRAY REST API

I am using below end point for getting the test runs of test case in Xray , however the JSON response I get multiple test runs the test cases is linked to.

Is there a way to add a sort/order parameter to an API url query string so that latest test run should come at the top of list.

GET /rest/raven/2.0/api/test/{testKey}/testruns

Sample response :

{
        "id": 7,
        "status": "PASS",
        "testKey": "test-2345",
        "testExecKey": "test-1234",
        "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/follettkyle/128.jpg"
    },
    {
        "id": 2,
        "status": "TODO",
        "testKey": "test-2345",
        "testExecKey": "test-8956",
        "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/araa3185/128.jpg"
    }
]}

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Tushar Daharwal 

Xray has no such feature and all endpoint options available are detailed on our REST API documentation, so when available it will be listed there.
Any other response has to be handled on the user's side, you have to adjust and create such ordering.

For more information on our REST, please review the link REST API.

Best Regards, 

 

Sérgio Freire,

Solution Architect and Testing Advocate @Xray

Personal blog on testing, Agile, and software development: https://sergiofreire.com

Follow me on Twitter: https://twitter.com/darktelecom

Thanks @Sergio Freire . Also could you please help me with below query ?

 I have been trying to send the evidence of test runs to Xray using below PUT method, but unable to attach files to test execution

PUT:  https://jira.****.net/rest/raven/2.0/api/testrun/****

Note: Test Run Status is getting updated but the file is not getting attached. Can "filename" accept file path ?

JSON Body:

{    

"status""PASS",    

"comment":"{TD Test Comment}",    

"evidence":{       

 "add:[{            

"filename":"C:\\Users\\tda090\\Desktop\\provar.pdf",            

"contentType""application/pdf",            

"data""(base64 encoding...)"        }
        ]    }

}

@Tushar Daharwal , filename should be just the file's name, without path whatsoever.

Regards

Sérgio

Thanks @Sergio Freire

Is there a way to pass the file path as I need to pull the file from specific folder in project. Tried storing the path with filename into variable and passing the variable as a string in "filename" but its not helping.

Perhaps as a comment or as a Test Run custom field...?

Please have a look at:

https://docs.getxray.app/display/XRAY/v2.0#/Test%20Run/put_testrun__id_ 

Suggest an answer

Log in or Sign up to answer
TAGS

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