This repository has been 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 May 25, 2019
·
17 revisions
Your are limited to 1000 requests per minute per ip address, so unless you spam the api you should be fine :)
- If you want a random picture from all languages, just call https://rcgp.anjara.eu/api/image
- If you need a specific language, you can check the list of languages by calling https://rcgp.anjara.eu/api/categories
- And with that you can specify the language you want by calling https://rcgp.anjara.eu/api/image/{category}
If you want C++ for example : https://rcgp.anjara.eu/api/image/cpp
- If you want a random picture from all languages, just call https://rcgp.anjara.eu/api/raw
- If you need a specific language, you can check the list of languages by calling https://rcgp.anjara.eu/api/categories
- And with that you can specify the language you want by calling https://rcgp.anjara.eu/api/raw/{category}
If you want JavaScript for example : https://rcgp.anjara.eu/api/raw/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.
// I totally disapprove what that thing up says -- leonekmi
const https = require('https');
req = https.request({
hostname: 'rcgp.anjara.eu',
port: 443,
path: '/api/image',
method: 'GET',
ecdhCurve: 'X25519' // Or any other curve supported by the webserver.
}, (res) => {
var data;
res.on('data', (d) => {
data = data + d;
});
res.on('end', () => {
var json = JSON.parse(data);
// do something here
});
});
req.end();