How to create a jira issue (type: test) with params dataset

Detlev March 29, 2023

Currently I try to create a issue of type test with a params dataset.

The creation of an issue of type test without a params dataset works fine, but when I try to add the customfield for the params dataset I get an 400 as response for my request.

Unfortunatelly I can't find any documentation for creating issues with param datasets.

 

Her you can see how my request looks like and what the response is.

As I said the normal creation of the issue of the type test works normal and the issue will be created without anny error only if I add the customfield to the fields structure the error occurse.

 

JiraConnector_src_Example_1.pngJiraConnector_src_Example_2.pngJiraConnector_src_Example_3.png

hopefully you can help me with this problem, to solve it. I've also tried some variations of the customfield structure for the params customfield, e.g. with and without the datasetRestBean tag but it leads allways to the 400.

I havn't also find any documentation if I have to use a special operation to add params to an issue like I can do it for adding comments to an issue with

" String requestURL = "rest/api/2/issue/" + testID + "/comment";
   String jsonString = "";

   jsonString = "{\"body\": \""+ comment + "\"}";"

 

best regards

 

Detlev

1 answer

0 votes
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2023

It's most likely that the field is not supported by REST - I assume since there doesn't appear any documentation for that field, you took a sample value from a sample issue with a GET and then tried to PUT/POST it?

Probably the format is different between what the user "enters" and what Jira "shows". I don't know what field type that is, but maybe if you can do some updates in browser (while watching the http requests in dev tools), you could see what format is being used in the payload.

If that is a regular field in the sense the field's value is sent as a parameter when you try to update the issue, and it doesn't use it's own and custom REST interface for CRUD stuff.

If it's not using Jira's native servlet/payload, and if it does use it's own custom REST, then at best you would need to create the issue first, and then update it afterward to supply the field:value over REST.

And since this seems undocumented, of course this will be prone to any changes in the future should the vendor decide to change something.

So overall I'd first check what sort of interface that field uses in browser to begin with, if it's just a field:value in the payload (along with all the other fields), it might be worth a shot.

But even if you get the format right, it doesn't guarantee that it will work, because browser and REST use different endpoints, so there might be some difference between how they will handle the values (really not sure).

You could ask the vendor too if they can give a hint what and how to do and/or public documentation for it, but I assume the use case is.. slim.. for this to be missing, they have a lot of things documented already. Again, I don't know what field that is so I'm not going down that line, but this is overall what I'd try.

Detlev March 30, 2023

Hi Radek,

 

thanks for your answer.

That was also my Idea, to create the issue and try to set the customfield afterward, but it leads to the same error and the customfield was not set.

 

Here ist the response I get from an issue where the customfield is set:

 

customfield_16600_from_issue.png

 

and here is the response whenn I'm request the general field definitions:

 

customfield_16600_general_field_definition.png

 

Maybe you have any other idea which is worth to look into it....

Meanwhile I guess I have to write to atlassian and ask them, if there is a possibility to set the Dataset of an "test" issue via rest api and how :(

I have made so many tries which various combinations for setting or updating customfiled of issues... and all were not successfull :(

 

best regards

 

Detlev

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2023

What I meant was viewing the issue, and modifying it manually to see what kind of http requests it will use.

 

This is a 3rd party custom field, it's not out of box so Atlassian won't be of help. It's Xray (https://marketplace.atlassian.com/apps/1211769/xray-test-management-for-jira?hosting=datacenter&tab=overview) so that's up to Xblend:

 # https://xraysupport.getxray.app

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2023

Aaaaand now knowing it's xray.. this seems to be related to datasets

https://docs.getxray.app/display/XRAY/v2.0#/Dataset

Detlev March 31, 2023

Hi Radek,

thanks a lot for your help.

Yes, it seems to be as I have to use somehow the dataset import/export resquest to handle datasets for test issues.

 

The following request will be send if I open the issue in jirra and export an existing dataset:

 

Dataset_Export.png

 

But when I try to use this request in JAVA I still get a 405:

 

Dataset_Export_Java.pngDataset_Export_Java_Response.png

 

In generell the rest api for XRay works. If I do the following request the response is correct and all steps of the test issue will be displayed.

String requestURL = "rest/raven/1.0/api/test/PLAT-5233/step";

or 


String requestURL = "rest/raven/2.0/api/test/PLAT-5233/steps";

 

So something with the dataset export request seems to be wrong in the way I try to use it...

 

Maybe you have any Idea about it.

I will try some combinations, maybe sometime I get accidently the right format ;)

 

Best regards

 

Detlev

Suggest an answer

Log in or Sign up to answer