Introduction
Learn how to use UrlHum Rest APIs
UrlHum has very basic REST API at the moment.
The authentication is made via Bearer Token that identifies the user.
Users can create their own access tokens going in their profile section using the menu: /profile/access-token
Access Tokens don't expire. Users can see last used time, add new access tokens (giving them a name) and remove them.
When creating an access token, users will be provided with the plain token that will be visible just that time. Reloading or closing the page will result in the token lost and the user will need to create it again.
The only endpoint currently available is for creating a short url.
Making requests
Every request must include the following headers:
Content-Type: application/json
Accept: application/json
Authentication: Bearer {token}
Replace token with your own token obtained previously.
Obviously the body of the request must be a valid JSON.
Every endpoint is actually prefixed with /api/v1/
Handling errors
UrlHum responses vary based on the error generated.
Status code | Error type | Reason |
---|---|---|
404 | Endpoint not found | Using a non-existing endpoint |
404 | URL not found | Short URL in request doesn't exist |
403 | Forbidden | User Token is not allowed to perform this action |
409 | Parameters or generic error about the URL | You may have passed an invalid parameter. Read message response key to know the reason |
500 | Unhandled exception | Server error. Check the error logs. |
401 | Unauthenticated | Token is invalid. |
Updated over 3 years ago