Problem connecting to API via HttpRequest

Created at 03 Oct 2023, 06:37
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
stuart's avatar

stuart

Joined 24.01.2018

Problem connecting to API via HttpRequest
03 Oct 2023, 06:37


Hi

I would like to connect to a API but I am not getting the Token.

I have it working in Postman and have made the Headers the same in the cAlgo

The main issue would be I have no visibility to the methods behind the cTrader wrapper for HttpRequest.

The Headers have a problem getting set correctly. 

How can I debug this further?  Any pointers would be helpful.


@stuart
Replies

stuart
07 Oct 2023, 08:45

 

Thank you to AKS on telegram for finding the issue :-)

There is a bug with HttpRequest where it does not set the Header  “Content-Type”

So if you need it as part of the API call you can add a directive to httpd.conf (apache) to force all requests to have the header you need. 

 

But its a bug that needs fixing..


@stuart