Some examples in various environments that will help get you started.
curl --get -H 'Accept: application/json' \ -u username:password \ https://rest.reserve-online.net/availability?location=Athens\&checkin=2024-11-05\&nights=1\&sort_by=POPULARITY
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://rest.reserve-online.net/availability?location=Athens&checkin=2024-11-05"); curl_setopt($ch, CURLOPT_USERPWD, "username:password"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch);
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; try { URL url = new URL("https://rest.reserve-online.net/availability?location=Athens&checkin=2024-11-05"); String encoding = new sun.misc.BASE64Encoder().encode("username:password".getBytes()); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setRequestProperty("Authorization", "Basic " + encoding); InputStream content = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(content)); String line; while ( (line = in.readLine()) != null ) { System.out.println(line); } } catch (Exception e) { e.printStackTrace(); }
<cfhttp url="https://rest.reserve-online.net/availability" charset="utf-8" method="GET" result="response" timeout="10" throwOnError="no"> <cfhttpparam type="header" name="Authorization" value="Basic #ToBase64('username:password')#"> <cfhttpparam type="header" name="Accept" value="application/json"> <cfhttpparam type="header" name="Accept-Language" value="en"> <cfhttpparam type="URL" name="location" value="Athens"> <cfhttpparam type="URL" name="checkin" value="2024-11-05"> </cfhttp>