Dólar
GET
https://cl.dolarapi.com/v1/cotizaciones/usd
Cotización del dólar estadounidense en pesos chilenos
Respuestas
Devuelve la cotización del Dólar
application/json
JSON
[
{
"compra": 0,
"venta": 0,
"ultimoCierre": 0,
"nombre": "string",
"moneda": "string",
"fechaActualizacion": "string"
}
]
GET
https://cl.dolarapi.com/v1/cotizaciones/usd
Playground
Ejemplos
cURL
curl https://cl.dolarapi.com/v1/cotizaciones/usd
JavaScript
fetch('https://cl.dolarapi.com/v1/cotizaciones/usd')
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cl.dolarapi.com/v1/cotizaciones/usd",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Python
import http.client
conn = http.client.HTTPSConnection("cl.dolarapi.com")
conn.request("GET", "/v1/cotizaciones/usd")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))