Skip to content

Instantly share code, notes, and snippets.

@abou7mied
Created April 19, 2020 17:29
Show Gist options
  • Save abou7mied/9e3aeb2194b67b492d4aa08073cdad73 to your computer and use it in GitHub Desktop.
Save abou7mied/9e3aeb2194b67b492d4aa08073cdad73 to your computer and use it in GitHub Desktop.
const rp = require('request-promise-native');
async function getTzId(apiKey) {
const response = await rp({
url: `https://onlinesim.ru/api/getNum.php?apikey=${apiKey}&service=other`,
method: 'GET',
});
// 97833
if (response.response === 1) {
return response.tzid;
} else {
throw new Error(response.response);
}
}
const apiKey = 'apiKey';
getTzId(apiKey).then((result) => {
console.log("result", result);
}).catch(error => {
console.log("error", error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment