Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Data.put gives an error "Field :custom_tags is not a valid array."


#1

When I am trying to add a test case, I get the error “Field :custom_tags is not a valid array.” Not sure how to give an array in the arguments for data.put
Any help appreciated.


#2

Hi!

Thanks for your posting. Multi-select fields require the following format for the API (JSON format):

"custom_tags": [1, 2, 3, 4] ..

Assuming you use one of our API bindings, you would usually be able to format this is a standard array and can pass this directly to the send-post API method (depending on the programming language).

http://docs.gurock.com/testrail-api2/start

I hope this helps!

Cheers,
Tobias


#3

Hi,

Thanks for the reply.
I tried using data.put(“custom_tags” : [1,2]);
but it gives me an error. Is there anything I’m missing?


#4

Can you let me know what kind of error you see? The error message or a screenshot would be great. Which programming language do you use?

The example I mentioned was the JSON notation and this looks different when using it from Java, for example:

List tags = new ArrayList();
tags.add(new Integer(1));
tags.add(new Integer(2));
data.put("custom_tags", tags);

Cheers,
Tobias


#5

Hi

Thanks for the reply. I am using java.


#6

Hi!

The code above should do the trick then. Please let me know in case any further questions come up, happy to help.

Cheers,
Tobias