This repository was archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
How to use the API ?
Skid edited this page Apr 15, 2018
·
17 revisions
and also, no rate limits but remain cool :)
- If you want a random picture from all languages, just call https://rcgp.nsa.ovh/api
- If you need a specific language, you can check the list of languages by calling https://rcgp.nsa.ovh/api/?listlanguages
- And with that you can specify the language you want by calling https://rcgp.nsa.ovh/api/?language=
If you want C++ for example : https://rcgp.nsa.ovh/api/?language=cpp
- If you want a random picture from all languages, just call https://rcgp.nsa.ovh/raw.php
- If you need a specific language, you can check the list of languages by calling https://rcgp.nsa.ovh/api/?listlanguages
- And with that you can specify the language you want by calling https://rcgp.nsa.ovh/raw.php?language=
If you want JavaScript for example : https://rcgp.nsa.ovh/raw.php?language=js
Note : You can use this as src for an <img>
tag also !
Enjoy :D
In NodeJS, the auto negociation process for ECC curve is crap, so if you try to use the api with NodeJS, generally it will return a magnificent error.
To solve this problem (unless NodeJS developpers fix this stupid issue) you need to specify the curve to use.
Here is an exemple of how to do it.
const https = require('https');
req = https.request({
hostname: 'rcgp.nsa.ovh',
port: 443,
path: '/api/',
method: 'GET',
ecdhCurve: 'sect571r1'
}, (res) => {
var data;
res.on('data', (d) => {
data = data + d;
});
res.on('end', () => {
var json = JSON.parse(data);
// do something here
});
});
req.end();