Create new Short URL
This endpoint allows to create a new Short URL.
Endpoint: /url
Method: POST
Parameters
Parameter | Required | Default | Description | Type |
---|---|---|---|---|
url | yes | - | The URL to shorten. | string |
custom_url | no | Generated by UrlHum | The shortened URL. | string |
is_private | no | no | If the URL must not be listed in the public URLs page. | int (0/1) |
hide_stats | no | no | If the URL statistics must be hidden to users who aren't owner of the URL. | int (0/1) |
Successful response
In case of success, you receive a 200 status code and the following JSON example response:
{
"message": "Success! Short URL created.",
"short_url": "WOz1"
}
If the long URL already exists, you will receive a response like this:
{
"message": "The Short URL for this destination already exists.",
"short_url": "WOz1",
"long_url": "https:\/\/urlhum.com"
}
Errors
In case of handled errors (not 500), you can receive a 409 error if there are problems (listed below) or 403 if you don't have permissions to create the Short URL.
Message | Reason |
---|---|
Url parameter cannot be blank or null | You didn't include the required url parameter in the request, it is blank or null. |
This short URL already exists. | You included the parmeter custom_url, but such custom url already exists on UrlHum. Choose another custom url. |
Updated over 3 years ago