Entering a Contest
Once you have the contest id you can use it to join the contest
const apiToken = "api token";
const contentJSON = JSON.stringify({
contestId: "",
userId: "",
contestType: "",
direction: "",
wager:""
});
const https = require('https');
const options = {
hostname: 'api.hxro.io',
port: 443,
path: '/hxroapi/api/ContestEntry/add-contest-entry',
method: 'POST',
headers: {
'Content-Type':'application/json',
'Ocp-Apim-Subscription-Key': apiToken,
'Content-Length': contentJSON.length
}
}
const req = https.request(options, (res) => {
res.on('data', (d) => {
console.log(JSON.parse(d))
})
})
req.on('error', (error) => {
console.error(error)
})
req.write(contentJSON)
req.end()
public void EnterContest
{
using (var client = new WebClient())
{
string uriString = "https://api.hxro.io/hxroapi/api/contestentry/add-contest-entry";
client.Headers.Clear();
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Ocp-Apim-Subscription-Key", _ocpkey);
byte[] responseArray = client.UploadData(uriString, Encoding.Default.GetBytes(_joinString));
var response = Encoding.UTF8.GetString(responseArray, 0, responseArray.Length);
}
}
Example of a proper request JSON object
{
"contestId": "contestId",
"userId": "string",
"contesttype": "OverUnder",
"direction": "moon",
"wager": "10"
}
Example of a successful response
{
"accountBalanceUpdates": [
{
"id": 0,
"balance": 0,
"modifiedDate": "2020-01-17T20:35:41.806Z"
}
],
"contestEntry": {
"id": "string",
"status": "Paid",
"enteredContest": "2020-01-17T20:35:41.806Z",
"contestType": "OverUnder",
"contestId": "string",
"userId": "string",
"username": "string",
"payout": 0
}
Updated over 3 years ago