REST connector and custom headers

Tagged:
  • Frantisek
        4 years ago #18420

        Hi,

        I am trying to integrate REST call via REST connector however I have some problems to correctly specify custom header.

        Target service API requires to sending X-CSRF-Token header.

        I tried various approaches to set head params in the input parameters of the REST call:

        headParams= {"X-CSRF-Token":"xyz"}
        
        headerParams={"X-CSRF-Token":"xyz"}
        
        headerParams["X-CSRF-Token"] = xyz

        Official documentation is very brief about this (also I think that correct parameter name is headerParams not headParams as mentioned there), so some real example would be great.

        Also is it possible to get headers from the response? As X-CSRF-Token is changing and unfortunately API sends it via headers…

        Thanks,

        Frantisek

         

        Mathieu Roll
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
          4 years ago #18421
          Up
          0
          Down
          ::

          Hello,

          because i don’t get were you have this lines of code i will post a full Documentation.

          First Create connector with connector call and test ist.

          Fine Works.

          So now we can go ahead to the Application.

          Works also Fine.

          The generated code if you won’t use the connector shape looks like this.

          var dataFortest_m002_test_customHeader = {};
          dataFortest_m002_test_customHeader['header'] = "someCoolCustomHeader";
          
          var cbFortest_m002_test_customHeader = function(data, optArg) {
          
          }
          
          this.callConnectorCall("test_m002", "test_customHeader", dataFortest_m002_test_customHeader, cbFortest_m002_test_customHeader, true, true, null);

          Reading the Head Params given back by the Service is not possible for now.

          Frantisek
              4 years ago #18425
              Up
              0
              Down
              ::

              Hi,

              thanks for extensive answer 🙂

              Sorry “the code” was from REST connector call configuration…

              Unfortunately it still doesn’t work… is this feature supported in Simplifier 3.5.74-LTS.98?

              Is there way how could I see what simplifier actually sends against the API?

              Regarding reading the header I find out in the documentation that there is something like Proxy Connector which should be useable for our usecase… however I didn’t find it in 3.5 version, so this is available only in 4.x series?

              Thanks,

              Frantisek

              Kahn
                  Has successfully completed the online course Introduction
                  Has successfully completed the online course Intermediate (200)
                  Has successfully completed the online course Advanced (300)
                4 years ago #18426
                Up
                0
                Down
                ::

                HeadParams should be in your old Simplifier Version as well.

                Hi, if you active the trace on the http-client you can see the request in the Backend log.

                 

                 

                Christian Kleinschroth
                    Has successfully completed the online course Introduction
                    Has successfully completed the online course Intermediate (200)
                    Has successfully completed the online course Advanced (300)
                    Has successfully completed the online course Basics (100)
                    Has successfully completed the online course Advanced (310)
                    Has successfully completed the online course Advanced (320)
                    Has successfully completed the Intermediate Certification
                    Has successfully completed the Advanced Certification
                  4 years ago #18434
                  Up
                  0
                  Down
                  ::

                  HI Frantisek,

                   

                  please be aware that Simplifier 3.5 is out of maintainance – you should use minium 4.0 or higher

                  Frantisek
                      4 years ago #18437
                      Up
                      0
                      Down
                      ::

                      Hi Christian,

                      yes we are working on update to Simplifier 4.0.

                      Regards,

                      Frantisek

                    Viewing 6 posts - 1 through 6 (of 6 total)

                    You must be logged in to reply to this topic.