Mediante la API REST de PeruApis.com puedes realizar consultas de datos desde tus aplicaciones de forma sencilla, simplemente enviando el parámetro document en tus solicitudes.
curl -X POST https://api.peruapis.com/v1/ruc \ -H 'Authorization: Bearer YOUR_ACCESS_KEY' \ -d "document=20295613620"
Especifica la dirección URL principal de la API
https://api.peruapis.com/v1
$apiKey = 'TU_API_KEY_AQUI'; $url = 'https://api.peruapis.com/v1/plate'; $document = 'BLQ141'; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('document' => $document), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer '.$apiKey, 'Accept: application/json' ), )); $response = curl_exec($curl); curl_close($curl); $json = json_decode($response);
var axios = require('axios'); var FormData = require('form-data'); var data = new FormData(); data.append('document', 'NUMERO_DE_DNI'); var config = { method: 'post', url: 'https://api.peruapis.com/v1/dni', headers: { 'Authorization': 'Bearer TU_API_KEY_AQUI', 'Accept': 'application/json', ...data.getHeaders() }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });