1 2 Previous Next 25 Replies Latest reply on Sep 27, 2018 9:20 AM by LJ LongWing

    REST API fields parameter

    Mike Chepaykin

      Having read the docs (Operations on entry objects - BMC Remedy Action Request System 9.1 - BMC Documentation ) I try to limit the number of fields returned in response from REST API, but get en error.

       

      Lets say, I want only Status and Group ID fields from Group form. My GET request URL looks like:

       

      http://<server>/api/arsys/v1/entry/Group/000000000000001?fields=values(Group+ID,Status)

       

      And returns an error:

       

      {"messageType":"ERROR",

      "messageText":"One of the items specified in the field or value list contains error.",

      "messageAppendedText":"Wrong query key values(Group ID,Status)",

      "messageNumber":124}

       

      So, how exactly should I form an URL to specify the fields list to be returned?

        • 1. Re: REST API fields parameter
          LJ LongWing

          Mike,

          I just tried, and used

           

          http://<server>/api/arsys/v1/entry/Group/000000000000001?fields=values(Group ID,Status)

           

          and it worked....the only difference is that I used a space instead of a + between Group and ID.

          • 2. Re: REST API fields parameter
            Mike Chepaykin

            Thanx, Lj. You gave me the idea to check the real url that was send via http, and I've found that all parameters were url-encoded, even the parentheses around fields list, like that:

             

            ?fields=%28Group+ID,Status%29

             

            If I leave parentheses intact - it works. So, field names can be escaped, but parentheses in values() and assoc() parameters should not.

            • 3. Re: REST API fields parameter
              Jan Sierens

              I still get an error using a copy of your url on our server:

               

              [

                {

                  "messageType": "ERROR",

                  "messageText": "One of the items specified in the field or value list contains error.",

                  "messageAppendedText": "Wrong query key Status)",

                  "messageNumber": 124

                }

              ]

               

              the parameters limit,q, etc.. seem to work. But I cannot get it to work with the fields parameter. We are on 9.1.

              • 4. Re: REST API fields parameter
                Carl Wilson

                Welcome to the wonderful world of RESTful parsing limitations ....

                Certain actions will require ASCII encoding, others XML, etc.

                 

                In RESTful, normally multiple parameters are specified in the following format:

                 

                ["value1","value2",Value3"]

                 

                The key/pair values are almost always contained in "".

                 

                Cheers

                Carl

                • 5. Re: REST API fields parameter
                  Jan Sierens

                  Hi Carl,

                   

                  But I do exact the same query as specified by LJ. And also tried without Group ID to avoid spaces.

                  I tried to add quotes, square brackets and url encode. But none of these helped.

                  BTW: I'm using postman to test as proposed by BMC.

                   

                  Best regards,

                  Jan

                  • 6. Re: REST API fields parameter
                    Peter Lundqvist

                    I seem to have the same problem (9.1.00.001). Have you come up with a solution?

                    • 7. Re: REST API fields parameter
                      Jan Sierens

                      No, sorry. Maybe I should log a ticket with BMC support.

                       

                      Jan

                      • 8. Re: REST API fields parameter
                        Peter Lundqvist

                        Support does not seem to be able to reproduce this error.

                        We have seen this on 9.1.0.001, 9.1.02.001, 9.1.02.002, 9.1.02.003 and 9.1.03.

                         

                        I am trying to see if there are any common factors for the problem.

                         

                        Infrastructure:

                        RHEL 7.3, Oracle 12c - all virtual machines.

                         

                        Softwarestack:

                        ARS+CMDB+Atrium Integrator, ITSM, SRM, SLM, ProcessDesigner

                         

                        Locale for the server process is sv_SE (UTF-8)

                        • 9. Re: REST API fields parameter
                          Tony Cosentino

                          Any update on this REST fields issue?  We also are using Remedy 9.1.x

                          • 10. Re: REST API fields parameter
                            Peter Lundqvist

                            Not really. I am currently persuing a case and, for what it is worth, support is not able to reproduce it.

                            If you are experiencing the problem and if you have the time to spare, maybe open a case? I guess it can't hurt.

                             

                            In any way, I will try to report back what happens with my case.

                            • 11. Re: REST API fields parameter
                              Peter Lundqvist

                              If you have this problem, try starting fiddler on the host you are experimenting and make sure it is capturing traffic. Then try it again.

                              Does it work for you too now?

                               

                              As soon as I close fiddler or stop capturing traffic, I get the error message.

                              I will try to get a traffic capture of this tomorrow.

                              • 12. Re: REST API fields parameter
                                Peter Lundqvist

                                "Always look at the network first. Network will show you the truth."

                                 

                                So... Looking at the request in wireshark when Postman communicated with the AR server gave me these two extracted HTTP GET requests:

                                Without fiddler capture

                                Hypertext Transfer Protocol

                                    GET /api/arsys/v1/entry/User?limit=10&fields=values%28Status,Login%20Name%29 HTTP/1.1\r\n

                                        [Expert Info (Chat/Sequence): GET /api/arsys/v1/entry/User?limit=10&fields=values%28Status,Login%20Name%29 HTTP/1.1\r\n]

                                            [GET /api/arsys/v1/entry/User?limit=10&fields=values%28Status,Login%20Name%29 HTTP/1.1\r\n]

                                            [Severity level: Chat]

                                            [Group: Sequence]

                                        Request Method: GET

                                        Request URI: /api/arsys/v1/entry/User?limit=10&fields=values%28Status,Login%20Name%29

                                            Request URI Path: /api/arsys/v1/entry/User

                                            Request URI Query: limit=10&fields=values%28Status,Login%20Name%29

                                                Request URI Query Parameter: limit=10

                                                Request URI Query Parameter: fields=values%28Status,Login%20Name%29

                                        Request Version: HTTP/1.1

                                With fiddler capture

                                Hypertext Transfer Protocol

                                    GET /api/arsys/v1/entry/User?limit=10&fields=values(Status,Login%20Name) HTTP/1.1\r\n

                                        [Expert Info (Chat/Sequence): GET /api/arsys/v1/entry/User?limit=10&fields=values(Status,Login%20Name) HTTP/1.1\r\n]

                                            [GET /api/arsys/v1/entry/User?limit=10&fields=values(Status,Login%20Name) HTTP/1.1\r\n]

                                            [Severity level: Chat]

                                            [Group: Sequence]

                                        Request Method: GET

                                        Request URI: /api/arsys/v1/entry/User?limit=10&fields=values(Status,Login%20Name)

                                            Request URI Path: /api/arsys/v1/entry/User

                                            Request URI Query: limit=10&fields=values(Status,Login%20Name)

                                                Request URI Query Parameter: limit=10

                                                Request URI Query Parameter: fields=values(Status,Login%20Name)

                                        Request Version: HTTP/1.1

                                I am not really sure of what is going wrong here - except for fiddler seemingly interfering with the traffic (not good). My gut feeling here is that the parenthesis should not be URL encoded (they can be both, but I feel this is part of the URL structure here). However, if they are encoded - the AR REST server can't handle it.

                                 

                                Thanks toLJ LongWing for probing me for a fiddler log. I had sort of given up.

                                • 13. Re: REST API fields parameter
                                  LJ LongWing

                                  Peter,

                                  I came across something VERY interesting regarding Postman today.  Internally here one of  my co-workers approached me regarding using the

                                   

                                  ?fields=values(field1, field2)

                                   

                                  and was getting the same 'Wrong query key values' that you were getting.  I was reminded about this post and referenced it....but I quickly realized that while she was having the same error as you, I was also using postman in the same way, and not getting the error....so, I started comparing her Postman with MY postman and found the difference.....

                                   

                                  Hers was Postman for Windows....

                                  Mine was Postman for Chrome....

                                   

                                  So...I had her install the Chrome plugin for postman and magically, hers started working just like mine was....so....I don't know why, but Postman for Windows seems to encode the URL automatically, where Postman for Chrome doesn't????

                                   

                                  I don't have all of the answers unfortunately, but I do know that Postman for Chrome was functional in a way that Postman for Windows wasn't.

                                  3 of 3 people found this helpful
                                  • 14. Re: REST API fields parameter
                                    Peter Lundqvist

                                    Awesome, and a bit terrible att the same time

                                    1 2 Previous Next