-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to delete urls #16
Comments
This library is really just a wrapper around the official YOURLS API which is read only for some reason. If you'd like to see delete functionality, you probably want to open a feature request issue on their repository or, better yet, a pull request that implements it. If delete functionally is added to the live API, I will be able to add it here. |
@neocotic Huh. That's weird. I found a plugin on their Plugins List. I know that this library is a wrapper for the official API only, but considering that this is a basic necessary feature, I hope you will agree to supporting this. |
I am reluctant to support individual unofficial YOURLS plugins as part of this library, however, the code is fully open source so you are free to fork and extend it. Alternatively, you could create a plugin for this library itself (see #9). |
I think I'll go the custom API route, doesn't seem difficult. I'll let you know how it goes. Thanks! |
For others' reference, I got it working with this:
yourls.deleteUrl = function(url, callback) {
var data = {
action: 'delete',
shorturl: url
};
this.sendRequest(data, ['statusCode', 'simple', 'message'], callback);
return this;
};
yourls.deleteUrl(url, (result, response) => {
console.log(result, response);
if (result.statusCode == 200) {
alert('Deleted url.');
} else {
alert('Error deleting. Check console.');
}
}); It would be neater to hack the URL instead of yourls itself, but hey, who reads the code right? |
Quite surprised to see there isn't any delete method. Could you please add it or give me a basic idea on how I could go about this? Thanks
The text was updated successfully, but these errors were encountered: