REST connector and custom headers
-
Frantisek4 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 RollHas successfully completed the online course IntroductionHas 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::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.
Frantisek4 years ago #18425::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
KahnHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Christian KleinschrothHas successfully completed the online course IntroductionHas 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 CertificationHas successfully completed the Advanced Certification
You must be logged in to reply to this topic.