How to pass key value pairs with webrequest()

 

I would like the req.body to be formatted as key value pairs like so:

req.body: { emailAddress: exampleemail@gmail.com, accessKey: 123456789, accountNumber: 12345 }

Improperly formatted code removed by moderator.

...

I'm used to javascript and axios where you can just pass an object as the payload, but I'm not seeing how I can do that with mql4 (in the docs they only pass a string in their example). This is what I'm getting in my server logs:

...

Improperly formatted code removed by moderator.

...

body: { 'exampleemail@gmail.com12345678912345\x00': '' }

I'm also wondering what the \x00 is at the end of the string as I did not add that.

This is the code from my EA where I've only been able to get it to work when passing strings:

...

int res;
char data[];
string payload = emailAddress + accessKey + IntegerToString(accountNumber);
   
ArrayResize(data, StringToCharArray(payload, data, 0, WHOLE_ARRAY, CP_UTF8), -1);
   
res = WebRequest("POST", herokuUrl, NULL, 0, data, data, payload);
Print(res);

Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.

Code button in editor

Hover your mouse over your post and select "edit" ... 

...

 
nameless nameless #After posting this the format of my code got put all on one line for some reason so sorry for the unreadability.

Please edit your post and format it properly. Preferably use a desktop browser instead of a mobile device.

Also, please don't use ALLCAPS for titles or sentences. It is considered shouting and is rude.