POST https://api.dhtask.com/dhtcalc/
Content-Type: application/json X-API-Key: [Your API Key]
Send a POST request with the following JSON payload:
{
"handicaps": [0.91, 0.95, 1.01, 1.02, 1.12, 1.29],
"task": {
"start": {
"name": "Start Point",
"lat": -35.91694931657839,
"lon": 146.3216672683199,
"radius": 10000,
"elev": "531ft",
"type": "line"
},
"turnpoints": [
{
"name": "Turnpoint 1",
"lat": -35.591384934695306,
"lon": 146.584998381584,
"radius": 500,
"variable": false,
"type": "point",
"elev": "512ft"
},
{
"name": "Turnpoint 2",
"lat": -35.08861812498515,
"lon": 147.1141604573383,
"radius": 500,
"variable": true,
"type": "point",
"elev": "560ft"
},
{
"name": "Turnpoint 3",
"lat": -34.9336172270555,
"lon": 146.30000190827582,
"radius": 500,
"variable": true,
"type": "point",
"elev": "428ft"
},
{
"name": "Turnpoint 4",
"lat": -35.98083207588561,
"lon": 146.20028114639027,
"radius": 500,
"variable": false,
"type": "point",
"elev": "435ft"
}
],
"finish": {
"name": "Finish Point",
"lat": -35.98971815199605,
"lon": 146.35749844070676,
"type": "line",
"radius": 3000,
"elev": "459ft"
}
}
}
The API will return a JSON response with calculated distances and turnpoint coordinates for each handicap value:
{
"h_0.91": {
"distance": 226.939,
"finish": {
"elev": "459ft",
"lat": -35.98971815199605,
"lon": 146.35749844070676,
"name": "Finish Point",
"radius": 3000,
"type": "line",
"variable": false
},
"start": {
"elev": "531ft",
"lat": -35.91694931657839,
"lon": 146.3216672683199,
"name": "Start Point",
"radius": 10000,
"variable": false
},
"turnpoints": [
{
"elev": "512ft",
"lat": -35.59138488474558,
"lon": 146.5849983504985,
"name": "Turnpoint 1",
"radius": 500,
"variable": false
},
{
"elev": "560ft",
"lat": -35.213646622733044,
"lon": 146.81430775940822,
"name": "Turnpoint 2",
"radius": 500,
"variable": true
},
{
"elev": "428ft",
"lat": -35.1664227049397,
"lon": 146.47942080363043,
"name": "Turnpoint 3",
"radius": 500,
"variable": true
},
{
"elev": "435ft",
"lat": -35.98083204462462,
"lon": 146.20028119387132,
"name": "Turnpoint 4",
"radius": 500,
"variable": false
}
]
},
// ... similar structure for other handicap values
}
fetch('https://api.dhtask.com/dhtcalc/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': '[Your API Key]'
},
body: JSON.stringify({
"handicaps": [0.91, 0.95, 1.01, 1.02, 1.12, 1.29],
"task": {
// ... task data as shown above
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
The API may return the following error responses:
GET https://json.dhtask.com/fetch/
This endpoint provides public access to the same JSON data available on json.dhtask.com. The endpoint supports CORS (Cross-Origin Resource Sharing), allowing it to be accessed from any domain.
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, OPTIONS Access-Control-Allow-Headers: Content-Type, Authorization
JavaScript fetch example:
fetch('https://json.dhtask.com/fetch/')
.then(response => response.json())
.then(data => console.log(data));