App Key works in demo tool but not in my application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hayko
    Junior Member
    • Jun 2017
    • 2

    #1

    App Key works in demo tool but not in my application

    Hi everyone. I have problem with App Key. I can made request and get result with "Betting Demo Tool", but when I try to do same request in my application I am getting 32099 "ANGX-007" "Invalid App Key" error. Do anyone know how to solve this problem?
    Below is code snippet from my application. I am using Javascript and Node js.

    const fs = require('fs');
    const request = require('request');
    const options = {
    url: 'https://developers.betfair.com/api.betfair.com/exchange/betting/json-rpc/v1',
    headers: {
    'X-Application': appkey,
    'X-Authentication': sessId,
    'content-type': 'application/json',
    "accept": "application/json",
    'Accept-Encoding': 'gzip, deflate',
    'Connection': 'keep-alive'
    },
    json:true,
    gzip:true,
    key: fs.readFileSync('client-2048.key'),
    cert: fs.readFileSync('client-2048.crt')
    };
    function requestForEventList() {

    options.body = {jsonrpc: "2.0", method: "SportsAPING/v1.0/listEvents", params: {filter:{eventTypeIds:["2"],inPlayOnly:true}}, id: 1};
    return new Promise((resolve, reject)=>{
    request.post(options, (err, httpResp, body)=>{
    console.log('list body-',body);
    if (httpResp && httpResp.statusCode == 200) {
    console.log(body);
    const returnArray = response.result.map((event) => {
    return {
    id: event.event.id,
    name: event.event.name,
    marketCount: event.marketCount
    };
    });
    resolve(returnArray);
    resolve([]);
    } else {
    reject({error: response.loginStatus});
    }
    });
    });
    }
  • only1jake
    Junior Member
    • Nov 2016
    • 29

    #2
    Should this be the url?:

    Instead of what you have:

    Comment

    • Hayko
      Junior Member
      • Jun 2017
      • 2

      #3
      Thank you. I used that url because it is used in Demo tool. Now I changed to https://api.betfair.com/exchange/betting/json-rpc/v1 and noticed that there was also problem with passing right session Id. Now it works. Thank you.

      Comment

      Working...
      X