POST JSON Data to a web page and get its Response via Delphi XE6 and the CEF4Delphi Chromium component (TChromium) -- 2

Job ID: 32181709

Budget: $8 – $15 USD

Description of the project

We have an existing mini Windows x64 project in Delphi XE6 that uses the TChromium component of CEF4Delphi (CEF4Delphi is an open source project to embed Chromium-based browsers in applications made with Delphi. See more here: https://github.com/salvadordf/CEF4Delphi) in order to access the web page of "www.interactivebrokers.com".

We have also a paper (demo) account in "www.interactivebrokers.com".

What we want to do is to be able:
1) to POST some JSON data to a web page of "www.interactivebrokers.com" (see POST syntax here:

https://www.interactivebrokers.com/api/doc.html#tag/Order/paths/~1iserver~1account~1{accountId}~1orders/post

and here:

https://interactivebrokers.github.io/cpwebapi/swagger-ui.html)

2) Get back the response of this POST request

We have written the necessary code to POST the JSON data (see 1 above) to the page but our code does not work. We are also missing the code to get back the response (see 2 above).

Our Source Code shows below:
-----------------------------------------------------------------------------------------------------
procedure TMainForm.Label2Click(Sender: TObject);
var
TempChromium : TChromium;
Header: ICefStringMultimap;
Data: ICefPostData;
Request: ICefRequest;

begin
if SearchChromium(2, TempChromium) then begin
Header := TCefStringMultimapOwn.Create;
Header.Append('Content-Type', 'Content-Type: application/json');

Data := TCefPostDataRef.New;
Data.AddElement(CreateField('acctId=' + ACCOUNT_ID));
Data.AddElement(CreateField('referrer=QuickTrade'));
Data.AddElement(CreateField('listingExchange=SMART'));
Data.AddElement(CreateField('conid=0'));
Data.AddElement(CreateField('conidex=10557'));
Data.AddElement(CreateField('secType=265598:STK'));
Data.AddElement(CreateField('side=BUY'));
Data.AddElement(CreateField('ticker=APPL'));
Data.AddElement(CreateField('quantity=1'));
Data.AddElement(CreateField('orderType=STOP_LIMIT')); // Other options are: STP MKT LMT MIDPRICE etc
Data.AddElement(CreateField('price=1.1'));
Data.AddElement(CreateField('LmtPrice=1.1'));
Data.AddElement(CreateField('auxPrice=1.1'));
Data.AddElement(CreateField('ticker=NUE'));
Data.AddElement(CreateField('tif=DAY'));
Data.AddElement(CreateField('useAdaptive=false'));
Data.AddElement(CreateField('outsideRTH=false'));
Data.AddElement(CreateField('isClose=false'));
Data.AddElement(CreateField('Transmit=false'));

Request := TCefRequestRef.New;
Request.Flags := UR_FLAG_NONE;
Request.Assign('https://www.interactivebrokers.co.uk/portal.proxy/v1/portal/iserver/account/' + ACCOUNT_ID +'/orders', 'POST', Data, Header);

TempChromium.Browser.MainFrame.LoadRequest(Request);

end; //if

end;
-----------------------------------------------------------------------------------------------------


Terms & Conditions

Please place your bid ONLY if you have experience in the TChromium component of CEF4Delphi.
We will pay for a working result ONLY.
On this project you are going to work remotely (via TeamViewer) on our Development computer.
At the end of this project we will need an invoice from you, which you will issue from www.freelancer.com (freelancer.com has this capability on their web site).

Please place your bid ONLY if your agree with all the above Terms & Conditions.
Related categories: Delphi JSON Chromium