The wi.nr API
Below is some brief documentation for using the wi.nr API to shorten and expand URLs.
The API KEY for requests can be obtained by signing in to wi.nr.
Shortening a URL
http://wi.nr/api/shorten
Parameters
url (required)
- The long URL to shorten. Please URL-escape. wi.nr will take care of cleaning up the URL for you (adding missing protocol and path where appropriate).
format (optional, default: text)
- The format you'd like the short URL returned in. Valid formats are
text and json.
api_key (optional)
- The API KEY of the wi.nr account you want to associate with this url. If not supplied, the submitter is not eligible to win (for this link).
Return Values
These are returned with a 200 OK HTTP Status Code.
- json format
- A json object with the member
url containing the full wi.nr URL.
- text format
- A text document containing the full wi.nr URL.
Error Codes
Error codes are returned differently depending on format. Error codes are always returned in the HTTP header. For text format they are returned as a text document containing [Status Code]: [Message]. For json format they are returned as a json object with status and message members.
- 302
- Returned if the supplied URL has already been shortened with this API KEY. This is only returned as a response code, the shortened URL is returned as in a successful request.
- 400
- Returned if the supplied URL is invalid.
- 503
- Returned if the client has made too many API calls in a certain amount of time. Generally you won't run into this unless you're doing something very wrong.
- 500
- Returned if the URL could not be shortened for any other reason.
Expanding a URL
http://wi.nr/api/expand
Parameters
url (required)
- The short URL to expand. Please URL-escape. This can be either a full wi.nr short url (
http://wi.nr/[hash]) or just the [hash] part of the URL.
format (optional, default: text)
- The format you'd like the expanded URL returned in. Valid formats are
text and json.
api_key (optional)
- The API KEY of the wi.nr account you want to associate with this API request.
Return Values
These are returned with a 200 OK HTTP Status Code.
- json format
- A json object with the member
url containing the long URL.
- text format
- The text string of the long URL
Error Codes
Error codes are returned differently depending on format. Error codes are always returned in the HTTP header. For text format they are returned as a text document containing [Status Code]: [Message]. For json format they are returned as a json object with status and message members.
- 400
- Returned if the supplied URL is invalid or empty.
- 404
- Returned if the supplied URL does not exist.
- 503
- Returned if the client has made too many API calls in a certain amount of time. Generally you won't run into this unless you're doing something very wrong.
- 500
- Returned if the URL could not be expanded for any other reason.