URL Shortener API \ Delete an URL PHP SDK
URL Shortener API Resources
Resource/URI | GET | POST | PUT | DELETE |
---|---|---|---|---|
Shortened URLs
/shorturls.json
|
List all shortened URLs | Shorten an URL |
– | – |
Shortened URL
/shorturls/<shorturl_token>.json
|
Retrieve URL details | – | – | Delete shortened URL |
Workflow
Request: the code to send to the API
Send a DELETE
request to the endpoint /shorturls/<shorturl_token>.json
to delete an existing entry.
Please take into consideration that a shortened URL will no long work after having been deleted. Users clicking on such a link will see an error message.
To prevent you from unintentionally deleting an entry by mixing up the DELETE/GET
methods
you have to include the url parameter confirm_deletion=true
in your DELETE
requests.
If you omit this parameter, the entry will not be removed and an error will be thrown.
Result: the code returned by the API
The API either returns a HTTP status code 200
if the entry was deleted successfully
or an appropriate message body with further details on the error that occured.
Example Resultset
1 2 3 4 5 6 7 8 9 10 11 12 13 | { "response" : { "request" : { "date" : "Tue, 23 Feb 2016 12:07:47 0100" , "resource" : "/shorturls/wZ2m2.json?confirm_deletion=true" , "status" : { "flag" : "success" , "code" : 200 , "info" : "The specified shorturl has successfully been removed" } } } } |