Shorten Documentation

Throttle: 100/Hour

POST /api;v1.0/shorten

JSON POST endpoint. Supports Validator Options!

Request

Parameters

raw
String
Raw Input to Shorten

Example

"raw": "http://juandefu.ca/"
validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE!
LOOSE_ASIS assumes percent encoding DOES NOT EXIST and any percent characters will be encoded!

The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
LOOSE_ASIS 3


Example

"validator": 0
uri
Boolean
Optional
Allow URIs to be Shortened

Example

"uri": true
urn
Boolean
Optional
Allow URNs to be Shortened

Example

"urn": true
private
Boolean
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

Example

"private": true
validate
Boolean
Optional
Validate Input
Input must be Valid and Validate must not be Throttled!

Example

"validate": true
validate-options
Object: URI Options
Optional
Validator Options
Default Options will be used when nil

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339

validated
Object: URI Validated
If Shortened is Throttled or an error occurs Validated will be ignored!


GET /api;v1.0/shorten

GET endpoint that only uses Query String Parameters. Supports JSONP!
Content must be properly encoded to fit within the Query String Field Variable "raw"!

Request

Parameters

raw
String
Raw Input to Shorten

Example

"raw": "http://juandefu.ca/"
validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE!
LOOSE_ASIS assumes percent encoding DOES NOT EXIST and any percent characters will be encoded!

The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
LOOSE_ASIS 3


Example

validator=2
uri
Exists
Optional
Allow URIs to be Shortened

urn
Exists
Optional
Allow URNs to be Shortened

private
Exists
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

validate
Exists
Optional
Validate Input
Input must be Valid and Validate must not be Throttled!

jsonp
String
Optional
JSONP will be used to pad the JSON payload with a Function.
Must be a-zA-Z and 15 characters or less.
If JSONP is set and is empty or invalid "ZeroOut" will be used!

Example

jsonp=Whoa
Whoa({});
pd
Exists
Optional
Should Input be Percent Decoded before being passed to the Validator?
Most Validators will do their own Percent Decoding of Input.
This should only be used if necessary or if the Validator does not support Percent Decoding.

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339

validated
Object: URI Validated
If Shortened is Throttled or an error occurs Validated will be ignored!


GET /api;v1.0/shorten/after?

GET endpoint that uses Directory Parameters and the whole content of Query String (?) as the Raw Parameter. Supports JSONP!
This is useful if you are unsure or unable to properly encode a Query String Variable.
This will not support Fragments if # is not encoded! Fragments are client side only!
Variables are appended to the Directory 'after' with the ; Delimiter and before the Query String! Order of parameters is not important.
Example:
Request: /api;v1.0/shorten/after;jsonp=Whoa;validate;validator=2?http://juandefu.ca/?hey=ya
Parameters: ;jsonp=Whoa;validate;validator=2
Validate: http://juandefu.ca/?hey=ya

Request

Parameters

validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE!
LOOSE_ASIS assumes percent encoding DOES NOT EXIST and any percent characters will be encoded!

The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
LOOSE_ASIS 3


Example

validator=2
uri
Exists
Optional
Allow URIs to be Shortened

urn
Exists
Optional
Allow URNs to be Shortened

private
Exists
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

validate
Exists
Optional
Validate Input
Input must be Valid and Validate must not be Throttled!

jsonp
String
Optional
JSONP will be used to pad the JSON payload with a Function.
Must be a-zA-Z and 15 characters or less.
If JSONP is set and is empty or invalid "ZeroOut" will be used!

Example

jsonp=Whoa
Whoa({});
pd
Exists
Optional
Should Input be Percent Decoded before being passed to the Validator?
Most Validators will do their own Percent Decoding of Input.
This should only be used if necessary or if the Validator does not support Percent Decoding.

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339

validated
Object: URI Validated
If Shortened is Throttled or an error occurs Validated will be ignored!