Important: Tr.im API is in Beta
This article shows you how to get hooks from short links and how to add hooks to short links, for full API functionality.
Get hooks from a short link
*Important: User (x-api-key) must be owner of provided short_url
Url: /links/{short_url}/hooks
short_url Shortened URL without proptocol ex. tr.im/f5QE1 or vanitydomain.com/45rtQ
Method: GET
Response
Parameter |
Type |
Description |
hook |
object |
Hook object from short_url
|
An Example Request:
POST http://tr.im/links/tr.im/double/hooks HTTP/1.1
x-api-key: 28542e01d8c1ea0fcaf791bd83169a13
Content-Type: application/json
An Example Response:
200 (Created)
ContentType: application/json
{"hooks":[]}
Add hooks to a short link
Url: /links/{short_url}/hooks
short_url Shortened URL without proptocol ex. tr.im/f5QE1 or vanitydomain.com/45rtQ
Method: POST
Request
Parameter |
Type |
Description |
Required |
hook |
string |
URL which should be called |
true |
Response
Parameter |
Type |
Description |
id |
integer |
Id of new created hook |
An Example Request:
POST /links/tr.im/Az34w/hooks HTTP/1.1
x-api-key: 7ec3c5647b5c732db85d11deca8f6d95
Content-Type: application/json
{ "hook": "http://google.com/do_something" }
An Example Response:
201 (Created)
ContentType: application/json
{ "id": 2 }
An Example Error Response could be:
400 (Bad request)
ContentType: application/json
{
"code": 400,
"message": "Validation Failed",
"errors": {
"errors": [
"short_url \"tr.im/Az34w\" does not exist"
],
"children": {
"hook": []
}
}
}
Comments