Jump to content

Guest074076

Members
  • Content count

    2
  • Joined

  • Last visited

Posts posted by Guest074076


  1. I removed session from the url and I am getting
    print r.text
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width" />
        <title>Ajax Test Harness</title>
        <link href="/TradingApi/Content/css?v=DIeV9tErqsXMXdK_zhXBay_u2zQ2TZi6am7tIyxAp6Y1" rel="stylesheet" type="text/css" />
        <link href="/TradingApi/Content/themes/base/css?v=ps9Ga9601PrzNA2SK3sQXlYmNW3igUv5FOdOPWptyus1" rel="stylesheet" type="text/css" />
        <script></script>
    </head>
        <body>
            <div style="width: 100%; margin: 0px;">
                <img alt="Gain|Capital Logo" src="/TradingApi/Images/Gain Logo White.png"/>
            </div>

    <script src="/TradingApi/Scripts/tradingApi.js" language="javascript" type="text/javascript"></script>
    <script src="/TradingApi/Scripts/corsTest.js" language="javascript" type="text/javascript"></script>
    <script src="/TradingApi/Scripts/json2.js" language="javascript" type="text/javascript"></script>
    <div id="apitest" style="padding: 10px; height: 100%">
        <h2>Ajax Test Harness</h2>
        <form id="form1" runat="server"></form>
        <hr />Script<br/>
        <textarea id="code" style="min-height: 300px; width: 100%">
            var userName = "<hidden>";
            doPost('/session',{ "UserName": userName, "Password": "password"}, function (data, textCode) {
                // Smoke Test
                doGet('/smoketest');
                setRequestHeader("UserName", userName);
                setRequestHeader("Session", data.Session);
                // Authentication Test
                doGet('/smoketest/authenticated');
                // Account Information Tests
                doGet('/useraccount/<hidden>/ChartingEnabled');
                doGet('/useraccount/ClientAndTradingAccount');
                // Need Valid Test Data doPost('/useraccount/Save', {"PersonalEmailAddress":"not@realaddress.com","PersonalEmailAddressIsDirty":true})
                // Cfd Markets Test
                doGet('/cfd/markets?marketname=uk&maxresults=10&usemobileshortname=true');
                //Logoff
                doPost('/session/deleteSession?userName='+userName+'&session='+data.Session);
     
            });
            /* var userName = "<hidden>";
                cityindex.corsTesting.doPost('/session',{ "UserName": userName, "Password": "password"}, function (data, textCode) {
                });*/
            </textarea>
        <br />
        <button onclick="eval($('#code').val()); " style="background-color: #2C5E81;border: 1px;color: white;padding: 5px;">Execute</button>
        <button onclick="clearResults();" style="background-color: #2C5E81;border: 1px;color: white;padding: 5px;">Clear</button><br />
        <br/>Result<br />
        <select id="result" style="background-color: #e4e4e4; min-height: 300px; width: 100%; height:100%" multiple="multiple"></select>
        <hr />
    </div>
            <script src="/TradingApi/Scripts/jquery-1.7.2.js"></script>
        </body>
    </html>
    Is this correct?  Where do I find the session token?

  2. I am getting an error when attempting to LogOn and obtain a session token.  The error from my POST request is error 500 Server Error.
     
    Here is my python code:
     
     
    headers = {'target':'session',
                      'uriTemplate':'/',
                      'transport':'POST',
                      'envelope':'JSON',
                      'Content-Type':'application/json'}
    data = {"Password":"<hidden>",
                "UserName":"<hidden>",
                "AppKey":"<hidden>"}
    r = requests.post(url = url, headers = headers, data = data)
    print r.text
    {"HttpStatus":500,"ErrorMessage":"Server error","ErrorCode":500}
     
    I confirmed with APISupport that my account is enabled for Live trading, so the account is not the issue.
     
    Is there something I'm missing?
×