Add Request Header to PUT REST action

0
Hi All, I am trying to access the REST servive and HTTP PUT to update some data. There is a request header - X-CSRF-Token which needs to pass along with PUT action. I am trying to pass this using addHeaderToNextRequest.... however I am still getting error that the CSRF token is not provided. Could you please tell me if I missed something while passing the header request. Also where can be check the Request Header being send on the PUT action. Regards, Anmol Bhat
asked
2 answers
0

As you refer to Cross Site Request Forgery, I think this will be a dead end. X-CSRF-Token is designed to be unable to predict, exactly to prevent requests like this: not executed by the end-user. Probably the error means that an incorrect token is supplied.

To check the headers send: I think you can change the loglevel of RestServices to Trace and see the Header and Body of the request made.

answered
0

Hi Johan,

Thanks for your reply.

Actually I am getting this CSRF token by using the Get method of the consumed REST service. If I do the same thing in Advance REST Client, it is working. I dont understand why it is not working when I do it through Mendix. I am passing Token dynamically which I get from the GET method.

Your help will be much appreciated.

Regards, Anmol Bhat

answered