Rally1

Expand all | Collapse all

Fields that can be queried using the REST API?

Jump to Best Answer
  • 1.  Fields that can be queried using the REST API?

    Posted 05-29-2018 07:44 PM

    Hi!

     

    I'm looking for some confirmation of the types of fields that are or are not able to be queried using the REST API. From what I've seen, most read-only fields can't be queried. Some, such as custom multi-select fields, which are read-only, can query for all allowed values except for the null value. Custom multi-select fields which are not read-only are able to query all values, including null. The query looks like this: query=(c_CustomMultiSelect%20contains%20%22null%22). This query works for the non read-only field, but not for the read-only field. Getting the attributes for the read-only custom multi-select field, it has valid AllowedQueryOperators and null is one of the AllowedValues. There are a number of other fields which seem to not support querying through the REST API, and they appear to be read-only, though there are also some read-only fields which do support queries. Is there a field attribute that I'm missing or some other way of determining whether a field is able to be queried or not?


    Thanks!

    Kiko



  • 2.  Re: Fields that can be queried using the REST API?

    Posted 05-30-2018 04:18 AM

    Kiko,

     

    The Web Services API Documentation will tell you what Fields are available, allowed query operators, if the field can be used in queries and other information.  It is available at https://rally1.rallydev.com/slm/doc/webservice/  

     

    You can create and test queries there as well.

     

    Michael



  • 3.  Re: Fields that can be queried using the REST API?

    Posted 05-30-2018 12:19 PM

    Hi Michael,

     

    I have done that, and found the results with the custom multi select field as mentioned above. The allowed query operators given are contains, !contains, containsall, containsany. I am able to query for allowed values, but not null. The null query (c_CustomMultiSelect contains null) results in this:

     

    {
    "QueryResult": {
    "_rallyAPIMajor": "2",
    "_rallyAPIMinor": "0",
    "Errors": [
    "Could not read: null for class UserStory for class UserStory"
    ],
    "Warnings": [],
    "TotalResultCount": 0,
    "StartIndex": 1,
    "PageSize": 20,
    "Results": []
    }

     

    on the 2016.1 version of Rally where the field is read-only, but works fine on the 2017.1 and on-demand instances that I have. I don't see any indication that this should be the case in the metadata given for the field. Is there something preventing a read-only field from having a null value? Is there some reason I'm unable to query for it?

     

    Cheers,

    Kiko



  • 4.  Re: Fields that can be queried using the REST API?

    Posted 05-30-2018 03:50 PM

    Hi Kiko,

    I just tried this and it's working for me. Below you can see my field's definition and the query I ran where I get accurate results.

     

    But: 

    I don't have the field as Read-Only. Also, I tried it again our SaaS whereas it sounds like you have On-Prem version.

     

    A possible alternative to (fieldName contains null) could be (fieldName contains "") - it returns the same results, so you may want to give that a try.

     

    If didn't help, we may want to open a support case for this. Can you let us know if you're on On-Prem. Also it sounds as if it's failing with 2016.1 but working with 2017.1. Is that a correct understanding?

     

     

     

     

     

     

    Thanks,

    Sagi



  • 5.  Re: Fields that can be queried using the REST API?

    Posted 05-31-2018 11:54 AM

    Hi Sagi,

     

    That is correct, this works on 2016.1 but not 2017.1, and I am using on-prem. Here is the field on the 2016 server:

    The query (c_CustomMultiSelect contains "") and (c_CustomMultiSelect contains "null") and (c_CustomMultiSelect contains null) all result in:

    {
    "QueryResult": {
    "_rallyAPIMajor": "2",
    "_rallyAPIMinor": "0",
    "Errors": [
    "Could not read: null for class UserStory for class UserStory"
    ],
    "Warnings": [],
    "TotalResultCount": 0,
    "StartIndex": 1,
    "PageSize": 20,
    "Results": []
    }
    }

    The field on the 2017 server is this:

    The only difference I can find is that one is read-only and one is not. I don't think as an administrator I am able to set the read-only status of a custom field, it seems that it's done by the server.

     

    Thanks,

    Kiko



  • 6.  Re: Fields that can be queried using the REST API?
    Best Answer

    Posted 06-05-2018 06:16 PM

    Hi Kiko,

    It sounds like a possible defect.

     

     

    Between your two last replies it's unclear which is and which isn't working. Can you please clarify for us:

     

    In 2016.1 the field is 'Read-Only' and this query has the error message. 

    In 2017.1 the field is not marked 'Read-Only' and this query works fine.

     

    Is that accurate?

     

    Sagi



  • 7.  Re: Fields that can be queried using the REST API?

    Posted 06-05-2018 06:28 PM

    Hi Sagi,

     

    Sorry, when I said it works on the previous reply, I meant getting the error on a null query. Your summary is accurate, the 2016.1 query has the error, 2017.1 works fine.

     

    Kiko 



  • 8.  Re: Fields that can be queried using the REST API?

    Posted 06-05-2018 06:40 PM

    Thanks Kiko for the clarification.

     

    It's best we'll continue via a support case. I'll want to reproduce it etc..

     

    I'll open a support case for you on this. I'll email you separately - directly and then we'll continue that way.

     

    Sagi