Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 2.23 KB

CustomEndpoint.md

File metadata and controls

45 lines (31 loc) · 2.23 KB

ram-api.js

Discord server npm version npm downloads Tests status

Back to readme

Back to Utils

Custom Endpoints Example

import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
// demo uses the latest api version
// hello returns { text }
new ramapi.Utils().customAsync("/hello", "demo", { params: { lang: lang } }).then(data => { console.log(data); }).catch(err => { });

//basic ended at v13, and v13 is retired

//pro, normal, or extended are also available options instead of demo below are examples NOTICE: extended only exists in v14 and v15


//v17
new ramapi.Utils().customAsync("/hello", "normal", { version: "v17", params: { lang: lang }, headers: {"token": "api key here"} }).then(data => { console.log(data); }).catch(err => { });

//v16 still uses the token header
new ramapi.Utils().customAsync("/hello", "normal", { version: "v16", params: { lang: lang }, headers: {"token": "api key here"} }).then(data => { console.log(data); }).catch(err => { });

//v15 and under use the api-key header
new ramapi.Utils().customAsync("/hello", "normal", { version: "v15", params: { lang: lang }, headers: {"api-key": "api key here"} }).then(data => { console.log(data); }).catch(err => { });