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

[solved] Include_all not boolean and cases_ids not an array


#1

Hello all,

I have been searching and trying different approaches, but I am stuck.

This is the POST request sent:
{"include_all":"false","case_ids":"[111615]","name":"Sprint 10 2","assignedto_id":23,"description":"A simple description.","suite_id":219}

But I receive a:
com.gurock.testrail.APIException: TestRail API returned HTTP 400("Field :include_all is not a valid boolean.")

I declared the boolean like this:
map.put("include_all", new Boolean(false));

I get rid of this error, when I replace the declaration by this:
map.put("include_all",0);

This is weird and I was just guessing for a solution. I did not find it documented like this.
Nevertheless, I get the next error, which is relates to case_ids
com.gurock.testrail.APIException: TestRail API returned HTTP 400("Field :case_ids is not a valid array.")

I was declaring the array of case_ids like this:

1.)
JSONArray case_Ids = new JSONArray(); case_Ids.add(new Integer(111615)); map.put("case_ids", case_Ids);
no success

2.)
List case_Ids = new ArrayList(); case_Ids.add(new Integer(111615)); map.put("case_ids", case_Ids);
no success

3.)
map.put(“case_ids”, “[111615]”);`
no success

So, I am out of luck after having tried the recommendations I found in this forum and in the documentation.

Any ideas, please?


#2

I solved it, it was my implementation error:
I wrote a JSON-Parser, that treats arrays as Strings and therefore converts them incorrectly.


#3

Hi Marvin,

Thanks for the update! The API wouldn’t allow strings for bool/array fields so that would be expected. Glad to hear you were able to get this working now!

Regards,
Marco


#4

I too tried all three options to pass values to case_ids key, but none of them worked. I tried JSONArray, Array & Arraylist and actual values but none of these worked. @marvin/@mgarcia can you please let me know what value did you pass for case_ids…how did you declare it etc. Any help is appreciated.