Jump to content

curl the api


Featured Comment

Posted

I'm trying to write a betting bot in C to access the API so I can post multiple bets on Asian Total markets and certain teams over and over again, but I'm having problems connecting to the API. I found this question from a few years back 

 which has a detailed command for connecting curl to stake, but I've tried it on my local machine running the same command with my API key, and get this error message:

curl 'https://api.stake.com/graphql' -H 'accept: */*' -H 'Referer: https://stake.com/' -H 'Origin: https://stake.com' -H 'x-lockdown-token: undefined' -H 'x-access-token: NOTSHOWN' -H 'content-type: application/json' --data-binary '[{"operationName":"StakeBalances","variables":{"available":true,"vault":false},"query":"query StakeBalances($available: Boolean = false, $vault: Boolean = false) {\n  user {\n    id\n    balances {\n      available @include(if: $available) {\n        currency\n        amount\n        __typename\n      }\n      vault @include(if: $vault) {\n        currency\n        amount\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"}]' --compressed

curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: *
--> long HTML output about page being in maintenance <--
curl: (6) could not resolve host: stake.com'
curl: (6) Could not resolve host: MY_API_KEY
curl: (6) Could not resolve host: application

Is it even possible to connect to Stake.com API using curl? If it is I'm appreciate some help on how it can be done.

Also if you have any more insight into how I can use the API (or whether it's possible currently), I'd love to hear how it's done, @Dan

Posted
Quote

curl 'https://api.stake.com/graphql' -H 'accept: */*' -H 'Referer: https://stake.com/' -H 'Origin: https://stake.com' -H 'x-lockdown-token: undefined' -H 'x-access-token: APIKEYHERE' -H 'content-type: application/json' --data-binary '[{"operationName":"StakeBalances","variables":{"available":true,"vault":false},"query":"query StakeBalances($available: Boolean = false, $vault: Boolean = false) {\n  user {\n    id\n    balances {\n      available @include(if: $available) {\n        currency\n        amount\n        __typename\n      }\n      vault @include(if: $vault) {\n        currency\n        amount\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"}]' --compressed

 

Works for me.

Try

Quote

 

Quote

*   Trying 13.224.103.101:443...
* Connected to api.stake.com (13.224.103.101) port 443 (#0)....

Posted
51 minutes ago, jonrhythmic said:

works, so I'm guessing it's some kind of formatting error in my code.

Do you have any idea how the format in curl has to be to register a bet at Stake? A full example would be greatly appreciated if you have one

@jonrhythmic https://curlconverter.com/ is your friend. Go to chrome, open the developer console, place any bet on originals, select the network transaction (right click> copy as curl), then use this website to convert it on whatever format you want.

  • 2 weeks later...
Posted

I'm still working on my Stake-bot, but I've switched to Node.js, since I couldn't get the C bot to connect to the api. Node.js works perfect, but I'm wondering if anybody knows how this query: 

  ActiveSportBets($limit: Int = 50

Could return all matches, not just the first 50? What should I set as limit to get all matches that are currently available to list?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

Privacy Policy Terms of Use