On this page
Making HTTP Requests from Challenges
Background
Often, when creating a challenge, you'll want to make an HTTP request to an external resource to consume an API, add custom logging, or pull down a dataset used in the challenge.
Language Support
Our code runner doesn't have wget or curl in most images, so request capabilities are generally limited beyond language features.
The languages with the best support are:
- C# (
System.Net.HttpandNewtonsoft.Json) - Dart (
HttpClientandjsonDecode) - Go (
net/httpandencoding/json) - Node JavaScript (
axiosorfetch) - PHP (
file_get_contents) - PowerShell (
Invoke-RestMethod) - Python (
requests,urllib,pandas) - R (
httr,jsonlite) - Ruby (
net/http) - Shell (
curl) - TypeScript (
axiosorfetch)
JVM languages support requests but don't currently have a good way to parse JSON at the time of writing. Please ask if you'd like us to add support.
Examples
The Spelling Checker challenge has minimal examples of making HTTP requests in many languages.