1 2 Previous Next 25 Replies Latest reply on Sep 27, 2018 9:20 AM by LJ LongWing Go to original post
      • 15. Re: REST API fields parameter
        LJ LongWing

        can you verify which version of postman you have that's having the issue?

        • 16. Re: REST API fields parameter
          Peter Lundqvist

          Sorry for not replying immediatly but I was not at work and unable to test this when I replied.

          I can confirm that I was using the standalone client when I was having the issue.

          I tried using the chrome version and there I no longer have the issue.

           

          Great detective work LJ LongWing!

           

          Mike Chepaykin, could you mark LJs answer as correct?

           

          • 17. Re: REST API fields parameter
            Shivakumar Mallinar

            LJ, I also tried Postman for Windows standalone app and I have the same problem and the error message.

            Chrome browser app seems to work OK.

            I tried all possible encoding with the string for ( , ) " etc no luck with Windows app;

            Is that a bug in the Windows postman app? How do we escalate this? Eventually Chrome app may get deprecated and we have to use Windows app and so we need a solution!

            • 18. Re: REST API fields parameter
              Rahul Singhai

              Hi

               

              AR Entry REST API accepts encoded query param. If we are making HTTP requests through web app frameworks likes Angular then it's HTTP module takes care of encoding the query parameters for you. Below is the working code for me in one of our application.

               

              This API call should just work fine.

                   /api/arsys/v1/entry/User?q=('Login Name'=$USER$)&fields=values(Login Name,Full Name)

               

              this.http.get(USER_URL + "?q=('Login Name'=$USER$)&fields=values(Full Name,Login Name,Group List)")

                                  .map((response: Response) => {

                              const userRes = response.json();

                             });

              Above request made by browser as below

              1. /api/arsys/v1/entry/User?q=(%27Login%20Name%27=$USER$)&fields=values(Full%20Name,Login%20Name,Group%20List)
              2. Request Method: GET
              3. Status Code: 200 OK
              4. Remote Address: 127.0.0.1:4200
              5. Referrer Policy: no-referrer-when-downgrade

               

              Not all REST clients (e.g. postman) are that friendly for supplying encoded query parameters. You may try using chrome plugin Advance REST Client (this). Below is a image for working request from this plugin. Postman chrome plugin works fine however there seems issue wit Postman desktop client.

                                                

               

              Hope it helps.

              Thanks. Rahul

              • 19. Re: REST API fields parameter
                Peter Lundqvist

                FYI: There is an issue filed at postmans github project:

                https://github.com/postmanlabs/postman-app-support/issues/3039

                 

                I can't say it has received a lot of attention :/

                1 of 1 people found this helpful
                • 20. Re: REST API fields parameter
                  Troy Sasso

                  Morning All,

                   

                  While testing this out on Windows client for POSTMAN I was also getting this error, I noted your URLS and added & as a Separator to the original URL, see the difference below.  I also added HTTP/1.1 to the end of the URL

                   

                  ORIGINAL with ERRORS: ERROR

                  http://192.168.125.129:8008/api/arsys/v1/entry/CHG:ChangeInterface?q=%27Vendor Ticket Number%27%20%3D%20%22TR65346534%22limit=1&fields=values(Infrastructure Change ID)

                   

                  Modified for Windows client testing; SUCCESS

                  http://192.168.125.129:8008/api/arsys/v1/entry/CHG:ChangeInterface?q=%27Vendor Ticket Number%27%20%3D%20%22TR65346534%22&limit=1&fields=values(Infrastructure Change ID) HTTP/1.1

                   

                  OR

                   

                  http://192.168.125.129:8008/api/arsys/v1/entry/CHG:ChangeInterface?q=%27Vendor Ticket Number%27%20%3D%20%22TR65346534%22&limit=1&field="Infrastructure+Change+ID"

                   

                  • 21. Re: REST API fields parameter
                    Brent Goodman

                    I have been playing with the REST API using Python. In POSTMAN, you drop the Query, Fields, Limit, and Sort into the query parameters. From Python, I have found that the BMC API is not able to decode the FIELDS, LIMIT, or SORT when used in the same way as the Query. These three options must be appended to the URL instead. Only the query can be urlencoded and put into the 'params=' variable. Everything within the ( ) needs to be encoded if any non-URL safe characters are used.

                     

                    I found that when using these in the 'params' variable, the "values()" part is also getting encoded. The brackets must not be encoded. This appears to be the same issues that POSTMAN is showing between the different browsers. Each browser is interpreting the information differently.

                     

                    fields=values(Infrastructure Change ID) vs fields=values%28Status,Login%20Name%29

                     

                    Once you find the work around for all the quirks, things get easier...

                     

                    For the Fields, Limit, and Sort, I build out the URL manually within my code, and pass any query into the params section:

                     

                    # Build out Return Fields (Do this for Field, Limit, or Sort as well. BMC API cant handle it as a param)

                    bgFields = "Restaurant,Status"

                    bgTmp = myURL + "?fields=values(" + bgFields + ")"

                     

                    # Build Query string

                    bgQuery = "'Restaurant' LIKE \"Test%\" AND 'Status' = \"Proposed\""

                    search_params = {'q': bgQuery}

                     

                    # Do get the request

                    myR = requests.get(url = bgTmp, headers = myHeaders, params=search_params, verify=False)

                    • 22. Re: REST API fields parameter
                      Jan Sierens

                      Trial and error I came to this conclusion:

                      • For the fields parameter the spaces need to be url encoded and the parenthesis not.
                      • For the q parameter. There is no need to add the outer parenthesis. But all inside needs to be url encoded.

                       

                      I my opinion it is not good practice to not allow to url encode the parenthesis.

                       

                      • 23. Re: REST API fields parameter
                        Peter Lundqvist

                        So issue #3039 has been closed, not resolved, and is now tracked in an issue (#4555) with a lot of other encoding issues:

                        URL params encoding · Issue #4555 · postmanlabs/postman-app-support · GitHub

                        1 of 1 people found this helpful
                        • 24. Re: REST API fields parameter
                          LJ LongWing

                          unfortunately, the problem is that Remedy should allow you to encode things....so while it's a bug on the Postman side....shouldn't you be able to encode the entire line in Remedy?

                          1 2 Previous Next