1 Reply Latest reply: Aug 24, 2018 4:18 PM by Levi Turner RSS

    QRS API: orderby using child property (e.g. stream name)

    Damian Rowe

      Hi,

       

      I'm using the QRS API to get a list of apps.  I can sort the list by app name using orderby=name in the query string. I want to be able to be able to sort the list by stream name but I can't figure out how to do this.  Does anyone know if it's possible to apply a sort that uses a child property such as stream.name or stream.id?

       

      Thanks

        • Re: QRS API: orderby using child property (e.g. stream name)
          Levi Turner

          Hey Damian,

           

          So it looks like there is a bug on the Repository side whereby standard orderby-ing will not work when the order condition has empty values.

           

          Example Working: /qrs/app/full?orderby=stream.name&filter=(name eq 'zzz')

          Example failure condition: /qrs/app/full?orderby=stream.name

           

          So it looks like there is a bug on the Repository side whereby standard orderby-ing will not work when the order condition has empty values.


          In lieu of that (while it's getting resolved), you can use

          POST /qrs/app/table?orderAscending=true&sortColumn=stream.name

          Body:

          {
              "entity": "App",
              "columns": [
                  {
                      "name": "id",
                      "columnType": "Property",
                      "definition": "id"
                  },
                  {
                      "name": "name",
                      "columnType": "Property",
                      "definition": "name"
                  },
                  {
                      "name": "owner",
                      "columnType": "Property",
                      "definition": "owner"
                  },
                  {
                      "name": "publishTime",
                      "columnType": "Property",
                      "definition": "publishTime"
                  },
                          {
                      "name": "stream",
                      "columnType": "Property",
                      "definition": "stream"
                  }
              ]
          }
          

           

          Hope that helps.