webrequest

 
need help 

curl -X GET "https://api.tradejini.com/v2/api/account/details" \
 -H "Accept: application/json" \
 -H "Authorization: Bearer 4d4ac4fb8d6289f6bf3f91e99a07b50e:a8999824d04ca5c62895d44975036816" \


above is curl and is working properly in python and other language as well as 

and i convert into mql4 code. below is code

void OnStart()
{
    // Set up parameters for the request
    string cookie = NULL, headers;
    char post[], result[];
    int res;

    string method = "GET";
    string url = "https://api.tradejini.com/v2/api/account/details";

    string api_key = "4d4ac4fb8d6289f6bf3f91e99a07b50e";
    string access_token = "a8999824d04ca5c62895d44975036816";

    headers = "Accept: application/json\r\n";
    headers += StringFormat("Authorization: Bearer %s:%s", api_key, access_token);
    Print(headers);

    ResetLastError();

    int timeout = 2000; // Timeout below 1000 (1 sec.) may not be enough for slow Internet connection
    res = WebRequest(method, url, cookie, NULL, timeout, post, 0, result, headers);
    Print(res);

    // Check the response code
    if (res >= 0)
    {
        Print("Request Successful. Response Code: ", res);
        Print("Server Response: ", CharArrayToString(result));
        Print("Response Headers: ", headers);
    }
    else
    {
        Print("Error in the request. Response Code: ", res);
    }
}

but i received error 

error is 

0 21:46:25.593 Script send_cubeplus XAUUSD,M5: loaded successfully

0 21:46:25.623 send_cubeplus XAUUSD,M5: initialized

0 21:46:25.623 send_cubeplus XAUUSD,M5: Accept: application/json

Authorization: Bearer 4d4ac4fb8d6289f6bf3f91e99a07b50e:a8999824d04ca5c62895d44975036816

0 21:46:26.012 send_cubeplus XAUUSD,M5: 401

0 21:46:26.012 send_cubeplus XAUUSD,M5: Request Successful. Response Code: 401

0 21:46:26.012 send_cubeplus XAUUSD,M5: Server Response: {"s":"error","msg":"Unauthorized"}

0 21:46:26.012 send_cubeplus XAUUSD,M5: Response Headers: HTTP/1.1 401 Unauthorized

Connection: keep-alive

Date: Sat, 03 Feb 2024 16:16:25 GMT

Content-Length: 34

Content-Type: application/json

Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE

Access-Control-Allow-Headers: Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Origin, Access-Control-Allow-Headers, cache-control, content-type, DNT, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Set-Cookie, origin, accept, Authorization, X-BUILD

Access-Control-Allow-Credentials: true

Access-Control-Max-Age: 86400


0 21:46:26.012 send_cubeplus XAUUSD,M5: uninit reason 0

0 21:46:26.017 Script send_cubeplus XAUUSD,M5: removed


I need help to find error

 

MetaTrader 4 is old and does not support the more modern SSL/TSL versions and requirements.

So check what the requirements are for the web server.

 

The following is what MetaTrader 4 WebRequest supports (using the SSL Labs test page) ...

SSL/TLS Capabilities of Your Browser

User Agent: MetaTrader 4 Terminal/4.1400 (Windows NT 10.0; x64)


SSL 2 Protocol Support

Your user agent supports SSL 2. You should upgrade.

SSL 2 is a very old, obsolete, and insecure version of the SSL protocol. You can usually disable this protocol version in configuration, but modern clients don't support it at all. This really means that you should upgrade your software to a better version.


Protocols
TLS 1.3 No
TLS 1.2 Yes*
TLS 1.1 Yes*
TLS 1.0 Yes*
SSL 3 Yes*
SSL 2 No

Cipher Suites (in order of preference)
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ( 0xc02c )   Forward Secrecy 256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ( 0xc02b )   Forward Secrecy 128
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ( 0xc030 )   Forward Secrecy 256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ( 0xc02f )   Forward Secrecy 128
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 ( 0xc024 )  WEAK 256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 ( 0xc023 )  WEAK 128
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 ( 0xc028 )  WEAK 256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 ( 0xc027 )  WEAK 128
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA ( 0xc00a )  WEAK 256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA ( 0xc009 )  WEAK 128
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA ( 0xc014 )  WEAK 256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA ( 0xc013 )  WEAK 128
TLS_RSA_WITH_AES_256_GCM_SHA384 ( 0x9d )  WEAK 256
TLS_RSA_WITH_AES_128_GCM_SHA256 ( 0x9c )  WEAK 128
TLS_RSA_WITH_AES_256_CBC_SHA256 ( 0x3d )  WEAK 256
TLS_RSA_WITH_AES_128_CBC_SHA256 ( 0x3c )  WEAK 128
TLS_RSA_WITH_AES_256_CBC_SHA ( 0x35 )  WEAK 256
TLS_RSA_WITH_AES_128_CBC_SHA ( 0x2f )  WEAK 128
TLS_RSA_WITH_3DES_EDE_CBC_SHA ( 0xa )  WEAK 112
(1) When a browser supports SSL 2, its SSL 2-only suites are shown only on the very first connection to this site. To see the suites, close all browser windows, then open this exact page directly. Don't refresh.


Protocol Details
Server Name Indication (SNI) Yes
Secure Renegotiation Yes
TLS compression No
Session tickets Yes
OCSP stapling Yes
Signature algorithms RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, SHA256/RSA, SHA384/RSA, SHA1/RSA, SHA256/ECDSA, SHA384/ECDSA, SHA1/ECDSA, SHA1/DSA, SHA512/RSA, SHA512/ECDSA
Named Groups x25519, secp256r1, secp384r1
Next Protocol Negotiation No
Application Layer Protocol Negotiation No
SSL 2 handshake compatibility No
 
Fernando Carreiro #: The following is what MetaTrader 4 WebRequest supports (using the SSL Labs test page) ...

Ok thanks for answer.
I understand properly

Thank You...