<commit_before>var apiurl = "https://apisandbox.openbankproject.com/obp/v2.2.0";
var bankID = -1;
var accountID = -1;
var token = -1;

//login
function login(){
    var request = new XMLHttpRequest();
    request.onreadystatechange = function() {
        var json = JSON.parse(request.responseText);
        token = json.token;
    }
    request.open("POST", "https://apisandbox.openbankproject.com/my/logins/direct", true);
    request.setRequestHeader("Authorization","DirectLogin username=\"<EMAIL>\"\, password=\"<PASSWORD>\"\, consumer_key=\"<KEY>\"");
    request.setRequestHeader("Content-Type","application/json");
    request.send(null);
}
login();
//get request
function getRequest(theUrl){

    var request = new XMLHttpRequest();
    request.onreadystatechange = function() {
        var json = JSON.parse(request.responseText);
        token = json.token;
    }
    request.open("GET", apiurl + theUrl, true); // true for asynchronous
    return request;
}

//post request
function test(){
    var http = new XMLHttpRequest();
    var url = "get_data.php";
    var params = "lorem=ipsum&name=binny";
    http.open("POST", URL + url, true);

    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    http.onreadystatechange = function() {//Call a function when the state changes.
        if(http.readyState == 4 && http.status == 200) {
            alert(http.responseText);
        }
    }
    http.send(params);
}
<commit_msg>changed the api interface to accept the json requests as json<commit_after>var apiurl = "https://apisandbox.openbankproject.com/obp/v2.2.0";
var bankID = -1;
var accountID = -1;
var token = -1;

//login
function login(){
    var request = new XMLHttpRequest();
    request.onreadystatechange = function() {
        var text = request.responseText;
        try {
            var json = JSON.parse(text);
            token = json.token;
        }
        catch(err) {
        }
    }
    request.open("POST", "https://apisandbox.openbankproject.com/my/logins/direct", true);n   
    request.setRequestHeader("Authorization","DirectLogin username=\"<EMAIL>\"\, password=\"<PASSWORD>\"\, consumer_key=\"hznak4pyka33m2pn2yq5gr5le0x2itnnsbyht4jp\"");
    request.setRequestHeader("Content-Type","application/json");
    request.send(null);
}
login();
//get request
function getRequest(theUrl){

    var request = new XMLHttpRequest();
    request.onreadystatechange = function() {
        var json = JSON.parse(request.responseText);
        token = json.token;
    }
    request.open("GET", apiurl + theUrl, true); // true for asynchronous
    return request;
}

//post request
function test(){
    var http = new XMLHttpRequest();
    var url = "get_data.php";
    var params = "lorem=ipsum&name=binny";
    http.open("POST", URL + url, true);

    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    http.onreadystatechange = function() {//Call a function when the state changes.
        if(http.readyState == 4 && http.status == 200) {
            alert(http.responseText);
        }
    }
    http.send(params);
}

{'fraction_non_alphanumeric': 0.1458140253320976, 'fraction_numerical': 0.009267840593141797, 'mean_word_length': 3.172680412371134, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3920313', 'n_tokens_mistral': 1003, 'n_tokens_neox': 978, 'n_words': 223}