Important: Tr.im API is in Beta
Creating short links is what Tr.im does best! Follow the guidelines below to ensure successful trimming with your API integration.
To create a short link
Url: /links
Method: POST
Request
Parameter |
Type |
Description |
Required |
long_url string |
string |
The full URL to be shortened |
true |
seed |
string |
String used in hash algorithm (e.x.addnow_fb, addnow_tw) |
false |
keyword |
string |
Custom keyword for short link. By default it’sautomatically generated hash |
false |
vanity_domain
|
string |
Vanity domain of current authenticated user.Vanity domain should be verified |
false |
Response
Parameter |
Type |
Description |
url |
string |
Shortened URL |
keyword |
string |
Keyword of the URL |
An example request might look like:
POST /links HTTP/1.1
x-api-key: 7ec3c5647b5c732db85d11deca8f6d95
Content-Type: application/json
{ "long_url": "http://google.com", "seed": "addnow_fb" }
And an example response:
An example error response could be:
400 (Bad request)
ContentType: application/json
{
"code": 400,
"message": "Validation Failed",
"errors": {
"children": {
"longUrl": {
"errors": [
"Unable to shorten that link. It is not a valid url."
]
},
"keyword": [],
"vanityDomain": [],
"seed": []
}
}
}
Comments