Announcement

Collapse
No announcement yet.

Error calling data from listMarketCatalogue in API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error calling data from listMarketCatalogue in API

    Has anyone else had issues calling from listMarketCatalogue?

    I have tried both JSON REST and JSON-PCR using the coding samples on the API documentation.
    https://docs.developer.betfair.com/d...ranEventmarket

    code used is below:

    endpoint = "https://api.betfair.com/exchange/betting/rest/v1.0/"

    # header = { 'X-Application' : 'used my app key', 'X-Authentication' : 'used my session token' ,'content-type' : 'application/json' }

    # json_req='{"filter":{"eventIds": ["30373429"]}}'

    # url = endpoint + "listMarketCatalogue/"

    AND

    url="https://api.betfair.com/exchange/betting/json-rpc/v1"
    header = { 'X-Application' : 'used my app key', 'X-Authentication' : 'used my session token' ,'content-type' : 'application/json' }

    jsonrpc_req='{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventIds": ["30373429"]}}, "maxResults": "200", "marketProjection": ["COMPETITION","EVENT","EVENT_TYPE"], "id": 1}'

    response = requests.post(url, data=jsonrpc_req, headers=header)

    Neither of the above worked. Error messages are as follows:

    1) {"faultcode": "Client", "faultstring": "DSC-0018", "detail": {}}

    2) {
    "jsonrpc": "2.0",
    "error": {
    "code": -32700,
    "message": "DSC-0008"
    }
    }

    I cant see what my issue is, it works when changing to event types or event IDs, the event ID is currently valid. Anyone else have this problem?

  • #2
    Hi

    if you look at this example from the manual (Sorry about the formatting, the forum, wont let me paste formatted text)

    Code:
    [
    {
    "jsonrpc": "2.0",
    "method": "SportsAPING/v1.0/listMarketCatalogue",
    "params": {
    "filter": {
    "eventIds": [
    "27165685"
    ]
    },
    "maxResults": "200",
    "marketProjection": [
    "COMPETITION",
    "EVENT",
    "EVENT_TYPE",
    "RUNNER_DESCRIPTION",
    "RUNNER_METADATA",
    "MARKET_START_TIME"
    ]
    },
    "id": 1
    }
    ]
    you will see that after the eventId number there is only one curly brace before the next data, "maxResults" etc.

    If you compare that to your example, you will see that you have 2 curly braces at that position ?

    Your json string is perfectly valid, but your nesting of the elements doesnt match the example in the docs. I dont know for sure but there is a fair chance that is what is confusing it.

    Try changing the nesting and see if it fixes it ?

    Regards Geoff



    Comment


    • #3
      GeoffW is right - specifically, everything EXCEPT
      "id": 1
      should be part of params.

      So
      jsonrpc_req='{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventIds": ["30373429"]}}, "maxResults": "200", "marketProjection": ["COMPETITION","EVENT","EVENT_TYPE"], "id": 1}'

      should be

      jsonrpc_req='{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventIds": ["30373429"]}, "maxResults": "200", "marketProjection": ["COMPETITION","EVENT","EVENT_TYPE"]}, "id": 1}'

      The second curly bracket after the eventids should be after the marketProjection list.

      Comment


      • #4
        thanks for the replies, the above worked. sorry forgot to reply at the time.

        Comment

        Working...
        X