curl / bash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • decastroferro
    Junior Member
    • Aug 2016
    • 4

    #1

    curl / bash

    I am now attempting to get my betfair communication working
    using bash (winbash) and curl. I can successfully login
    and get a session ID but now am failing to get "list all
    event types" to work.

    My bash code looks like this:

    ================================================== ========
    # List all event types, providing app key and session token
    function list_all_event_types() {
    echo
    echo
    echo
    echo "LIST ALL EVENT TYPES"
    echo
    echo "SESSION_TOKEN:["$SESSION_TOKEN"]"
    echo "APP_KEY:["$APP_KEY"]"
    echo "HOST:["$HOST"]"
    echo
    echo "About to call curl command"
    OUT=`curl -s -X POST --header "Accept: application/json" --header "Content-Type: application/json" --header "X-Application: $APP_KEY" --header "X-Authentication: $SESSION_TOKEN" --data "{\"filter\":{}}" $HOST/rest/v1/listEventTypes/`
    echo "Curl command called, now print the output"
    echo $OUT
    echo "Output printed"
    }
    ================================================== ========

    But when I call it I see this:
    ================================================== ========
    LIST ALL EVENT TYPES

    SESSION_TOKEN:[xVEdQVCMVX/8NwMhEja9iyGRZqDUlAH2U2xWWUWKVpw=]
    APP_KEY:[MakJhXosuq9sbQIr]
    HOST:[https://api.betfair.com/exchange/betting]

    About to call curl command
    Curl command called, now print the output

    Output printed
    ================================================== ========

    As you can see the output from the curl command appears to
    be empty.

    Any ideas?
  • LiamP
    Junior Member
    • Oct 2015
    • 284

    #2
    Is that a real app key / session token? I hope not...

    Comment

    • decastroferro
      Junior Member
      • Aug 2016
      • 4

      #3
      Originally posted by LiamP View Post
      Is that a real app key / session token? I hope not...
      Don't worry, I did change a few characters :-)

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        Not certain about this, but take a look at these two threads:

        https://forum.bdp.betfair.com/showthread.php?t=2689
        https://forum.bdp.betfair.com/showthread.php?t=2259

        Your request will probably need to be in the form of a JSON string like the ones eventually used in these two threads.

        I don't know how the curl thing works, but these might help you sort out how to do ordinary calls. You can find more about JSON at the w3c website.

        Comment

        Working...
        X