Easy to use module, made to interact with the short.io API, shorten links, delete them & more.
Here's some exemple to kickstart your short.io integration, if you need documentation, refer to the GitHub Repository's Wiki.
IchiiDev/short.io is not affiliated to the website and enterprise short.io
If you want to use your short.io account with this package, here's some data you should get from your account:
- domain: The full domain redirected on the short.io service, exemple: short.domain.com.
- domainId: The ID of the managed domain, you can get it in the URL of the links panel, exemple: https://app.short.io/users/dashboard/**00000**/links < 00000.
- api_key: Your account API Key, you can manage yours here: https://app.short.io/settings/integrations/api-key/ (Only use your private key and do not publish it).
const shortio = require("short.io");
// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");
// This* gets a maximum of 150 links from your domain
short.getLinks().then(links => {
console.log(links); // Print your links
});
*More options available on the package's wiki page
const shortio = require("short.io");
// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");
// This gets a precise link informations, the 00000 is the link ID.
short.getLink(00000).then(link => {
console.log(link);
});
const shortio = require("short.io");
// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");
// This* creates a link on your short.io service.
short.createLink({ originalURL: "https://discord.gg/fr" }).then(link => {
console.log(link);
});
*More options available on the package's wiki page
const shortio = require("short.io");
// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");
// This deletes a link, the 00000 is the link ID.
short.deleteLink(00000) // Delete the link
.then(result => console.log(result)) // Display the result for debug
.catch(e => console.log(e)); // Catch error if one occures
Feel free to fork my work and propose changes. If you have any issues with my work, please open an Issue.
- @IchiiDev:
contact@ichiidev.xyz
(Contact E-Mail).
- Changed request dependency package from
request
tonode-fetch
(request
was deprecated). - Added promises to the
deleteLink()
andarchiveLink()
function.
- Fixed the
getLinks()
function, added more parameters likeoffset
,tag
andlimit
. - Added more documentation to the code
- Added the
updateLink()
function to permit link edition - Added the
getByOriginalURL()
function to get a link object by querying it's originalURL. - Removed useless functions parameters
- Corrected JS Doc errors
- Added domain, clicks and links stats methods
- Fixed some code execution errors
- Removed useless constants from the code
- Add more classes to improve package ergonomics => V2 (TypeScript)
- Global rewrite of the package in TS to improve documentation and code quality + user ergonomic => V2
V2 will come directly as the next update, there wont be any 1.4.0 for domain management (Theses methods will be added along with the V2)
IchiiDev/short.io is not affiliated to the website and enterprise short.io.