Same JSON Request, Different Results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DrKanye
    Junior Member
    • Oct 2015
    • 12

    #1

    Same JSON Request, Different Results

    I am trying to list the events given some parameters:

    Here is what I execute (using the API tool, and the response)

    Code:
    Request data: 
    [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEvents", "params": {"filter":{"eventTypeIds":["7"],"marketCountries":["GB"],"marketTypeCodes":["PLACE"]}}, "id": 1}]
    Controller.js?_dc=1444582376801:686 Response truncated to 4,000 chars: 
    [{"jsonrpc":"2.0","result":[{"event":{"id":"27566984","name":"Wind 12th Oct","countryCode":"GB","timezone":"Europe/London","venue":"Windsor","openDate":"2015-10-12T13:00:00.000Z"},"marketCount":8},{"event":{"id":"27566968","name":"Salis 12th Oct","countryCode":"GB","timezone":"Europe/London","venue":"Salisbury","openDate":"2015-10-12T12:50:00.000Z"},"marketCount":8},{"event":{"id":"27567030","name":"Sedge 12th Oct","countryCode":"GB","timezone":"Europe/London","venue":"Sedgefield","openDate":"2015-10-12T13:10:00.000Z"},"marketCount":7}],"id":1}]

    Now, if I do this in my application:

    Code:
    Calling: SportsAPING/v1.0/listEvents With args: {"filter":{"eventTypeIds":["7"],"marketCountries":["GB"],"marketTypeCodes":["PLACE"]}}
    
    Got Response: {"jsonrpc":"2.0","result":[{},{},{}],"id":1}

    I get nothing!! Yes I am logged in.

    Why!??!
  • DrKanye
    Junior Member
    • Oct 2015
    • 12

    #2
    Hello

    I use the betfair API, I haven't had any trouble until I implemented my own getEvents functionality:

    Here:

    public IList<Event> GetEvents(int nMaxCount, string type)
    {
    System.Net.ServicePointManager.Expect100Continue = false;

    m_Client = new JsonRpcClient(Url, Session.AppKey, Session.SessionToken);

    var marketFilter = new MarketFilter();

    marketFilter = new MarketFilter();
    marketFilter.EventTypeIds = new HashSet<string>() { "7" };
    marketFilter.MarketCountries = new HashSet<string>() { "GB" };
    marketFilter.MarketTypeCodes = new HashSet<String>() { type };

    var marketSort = MarketSort.FIRST_TO_START;
    var maxResults = nMaxCount.ToString();

    return m_Client.listEvents(marketFilter, marketSort, maxResults);
    }


    And here:

    public IList<Event> listEvents(MarketFilter marketFilter, MarketSort marketSort, string maxResult = "1", string locale = null)
    {
    var args = new Dictionary<string, object>();
    args[FILTER] = marketFilter;
    return Invoke<List<Event>>(LIST_EVENTS_METHOD, args);
    }


    The event method it calls is here:

    private static readonly string LIST_EVENTS_METHOD = "SportsAPING/v1.0/listEvents";



    I cannot see why this would return zero results. It works the same using the API tool?

    Thanks

    Comment

    • DrKanye
      Junior Member
      • Oct 2015
      • 12

      #3
      Here lies the problem:

      return Invoke<List<EventResult>>(LIST_EVENTS_METHOD, args);


      The API is not very helpful in this respect.

      Comment

      Working...
      X