You will need the API key to interact with our API gateway. To get your API key, email us. All API methods return a consistent set of return fields, error codes and messages
/shorten
Expects a long URL, optionally a comment to go with the link, and returns a short URLArguments:
Required
longurl (The url you would like to be shortened. URL encoded)
apikeyOptional
link_comment
Returns:
shorturl
hash (associated with the shortened or "LPRed" URL. You can use this to lookup a shortened URL)
Example:
http:/api.l.pr/shorten?apikey=axbymc46859i685jfk9fk&longurl=http%3A%2F%2Ffoxnews.com&link_comment=this+is+link+for+a+news+site
/expand
Expects a hash or a short URL and returns the associated long URLArguments:
Required
hash
OR
shorturl (URL encoded)
apikey
Returns:
longurl
link_comment (the comment associated with the URL, if available)
Example:
http://api.l.pr/expand?apikey=axbymc46859i685jfk9fk&hash=a42f6
http://api.l.pr/expand?apikey=axbymc46859i685jfk9fk&shorturl=http%3A%2F%2Fl.pr%2Fa42f6
Return results, Error Codes and Messages
All API methods return the following fields:
errorCode (Code associated with the error see below. Please specify which error code you are getting when requesting support)
errorMessage (Short message explaining the error.)
results (contains the returned results)
statusCode (OK if the method was successful in perform the action requested, ERROR otherwise )
List of error Codes
1 - apikey not supplied
2 - invalid api key
3 - longurl not supplied
4 - shorturl/hash not supplied. Supply either one
5 - No url found corresponding to that hash
Still have questions? Email us