1 2 Previous Next 15 Replies Latest reply on May 12, 2020 9:53 AM by Laurent Matheo

    Consume Rest API calls

    Rajashri Kumbhar
      Share This:

      Hi,

      I have been trying to consume REST calls using new feature in filter.

      I have tried to use AR login rest call.

      But I am getting 401 Unauthorized error even though the credentials are correct.

      I have attached arapi logs.

      Is there anything I am missing?

        • 1. Re: Consume Rest API calls
          LJ LongWing

          Rajashri,

          That isn't your base url, that's your authentication url....your base url is the one you would call to make your rest call....just remove jwt/login and you might be good.

          • 2. Re: Consume Rest API calls
            Rajashri Kumbhar

            Thanks for your reply.

            I am still getting the same error even after removing jwt/login.

             

            This working fine when tried with Postman.

            Any suggestions?

             

            Regards,

            Rajashri

            • 3. Re: Consume Rest API calls
              LJ LongWing

              What does a filter log show?

              • 4. Re: Consume Rest API calls
                Rajashri Kumbhar

                These are the logs for rest call.

                 

                I have tried with alternate method using custom headers

                The REST call is successful. But When I try to map response i.e. get sessiontoken it throws 'Unknown system error (ARERR 8790)'

                And arapi logs shows JsonParseException as ARLogin REST call gives us sessiontoken in text

                 

                 

                Is there any way to accept plain text from REST call response?

                • 5. Re: Consume Rest API calls
                  LJ LongWing

                  it seems like you are making authentication calls to get a token, instead of using the process to allow authentication to happen as designed, and make the call you want the results from.

                   

                  In relation to the parsing error...no, it's expecting a JSON response, which is why you don't make a call directly to the authentication...you make a call to get the results you want.

                  4 of 4 people found this helpful
                  • 6. Re: Consume Rest API calls
                    Amol Shinde

                    Hi LJ LongWing,

                     

                    We are also trying to call procees of helix platform(me.e Innovation Studio) using rest call thru filter.

                    Below are teh attached details:

                    1.

                    2.

                    3.

                    However, we are getting error “HTTP 500 Internal Server Error (ARERR 9130)

                    Is their anything that we are missing?

                    Teh same method is working well from Postman Client.

                     

                     

                     

                     

                     

                    .

                    • 7. Re: Consume Rest API calls
                      LJ LongWing

                      Do you have any filter logs that might show more details than just the end error?

                      • 8. Re: Consume Rest API calls
                        Amol Shinde

                        Yes,

                        I have attached it.

                        • 9. Re: Consume Rest API calls
                          LJ LongWing

                          Well, the only relevant information in that log is

                           

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:11.6420 */    Start filter processing (phase 1) -- Operation - CREATE on Vyom InnovationSuiteRest - <NULL>

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:11.6420 */ <Filter Level:0 Number Of Filters:0> Checking "VyomCreateRecord" (500)

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:11.6420 */    --> Passed -- perform actions

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:11.6420 */         0 : Set Fields

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:12.2070 */ **** Error while performing filter action. Error Number: 9130

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:12.2130 */ ERROR (9130): Error encountered while executing a Web Service; HTTP 500 Internal Server Error

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:12.2130 */ **** Filter "VyomCreateRecord": No enabled error handler

                          <FLTR> <TrID: borwofcTTVWndOQvcDarAA:0000044> <TID: 0000000279> <RPC ID: 0072775405> <Queue: Fast      > <Client-RPC: 390620   > <USER: Allen                                        > <Overlay-Group: 1         > /* Wed Apr 15 2020 00:46:12.2130 */    End of filter processing (phase 1) -- Operation - CREATE on Vyom InnovationSuiteRest - <NULL>

                           

                          And that doesn't provide any more detail.  I would suggest opening a ticket with BMC and see what additional details they can coax out of the call.

                          • 10. Re: Consume Rest API calls
                            Laurent Matheo

                            Amol Shinde, if you have ARS 19.11 or more recent try to add in the Authentication part this:

                            2020-05-05_9-23-54.jpg

                            Key: AUTH_HEADERX-Requested-By

                            Value: X

                            1 of 1 people found this helpful
                            • 11. Re: Consume Rest API calls
                              Amol Shinde

                              Thanks Laurent Matheo  for the solution.

                              I have added (key,value) in the filter. But,  it's still giving the same error(HTTP 500 Internal Server Error (ARERR 9130)).

                              • 12. Re: Consume Rest API calls
                                Marek Ceizel

                                You should also activate the RestAPI Logs. HowTo is here (depends on which version are you using):

                                Troubleshooting issues when calling a third-party REST API - Documentation for Remedy Action Request System 20.02 - BMC …

                                 

                                btw-on which version are you trying ?

                                • 13. Re: Consume Rest API calls
                                  Laurent Matheo

                                  Amol Shinde, what I would recommend is trying with something really simple rather than a post command.

                                  For starter, I think that the POST call url should be the full one, so https://......./command, do not put anything in "path params".

                                   

                                  Anyway like I said, try first to get a record instance, like this (adapt to your use case of course):

                                  GET

                                  Base URI:

                                  https://developerxxxx.innovate.bmc.com/api/rx/application/record/recordinstance/com.example.samplelibrary%3ADvd/AGGADG1AANVNMAP3I0SAP215VRKT6N

                                  In the GET custom headers, just add X-Requested-By with value X. It is not necessary for Get calls but this way it is already there. No need to pass the content type, in ARS it will always be application/json for now.

                                   

                                  For authentication of the GET call, something like this (adapt the url of course, and credentials which should contain the tenant name):

                                  TOKEN_AUTH_URI_METHOD

                                  POST

                                  TOKEN_AUTH_URI_PATH

                                  https://developerxxxx.innovate.bmc.com/api/rx/authentication/loginrequest

                                  TOKEN_AUTH_CONTENT_LOCATION_KEY

                                  REQUEST_BODY

                                  TOKEN_AUTH_AUTH_TOKEN_NAME

                                  AR-JWT

                                  TOKEN_AUTH_REQUEST_MEDIA_TYPE

                                  application/json

                                  TOKEN_AUTH_CONTENT_BODY

                                  {"userName":"youruser@yourtenant", "password":"The Password"}

                                  For example:

                                  {"userName":"calvin@developer.com", "password":"The Password"}

                                  AUTH_HEADERX-Requested-By

                                  X

                                   

                                  Then for the mapping if you want to map the field "8" of the record instance to the field "token" of the form since you have in json:

                                  fieldinstances.8.value

                                   

                                  You should have in the filter mapping "Json Key" part:

                                  fieldInstances|8|value

                                   

                                  Moreover, you need to be sure you have ARS 19.11 or above.

                                   

                                  Once you have this use case working it should be easier to adapt for the POST command.

                                  1 of 1 people found this helpful
                                  • 14. Re: Consume Rest API calls
                                    Danut Mosescu

                                    Hi Laurent,

                                     

                                    We have tried on our environment to set up the rest call exactly as specified in your post, but it still returns 500 Internal Error.

                                    The logs show the below:

                                    Tue May 12 2020 07:41:00.409 DEBUG arwkflow_restapiclient Populating REST data paramters from field values.

                                    Tue May 12 2020 07:41:00.419 DEBUG arwkflow_restapiclient Preparing client to invoke external REST api...

                                    Tue May 12 2020 07:41:00.568 ERROR arwkflow_restapiclient Error invoking external rest uri

                                     

                                    Also tried the loginrequest from postman where we receive the same error:

                                     

                                    Also are you saying that the call to IS will work only if you have AR version 19.11 or above?

                                    Thank you

                                    1 2 Previous Next