https://api.linkredirector.com
curl https://api.linkredirector.com \ -u API_KEY_GOES_HERE:
200 - OK | Everything worked as expected. | 400 - Bad Request | The request was unacceptable, often due to missing a required parameter. | 401 - Unauthorized | No valid API key provided. | 402 - Request Failed | The parameters were valid but the request failed. | 404 - Not Found | The requested resource doesn't exist.. | 429 - Too Many Requests | Too many requests hit the API too quickly. | 500, 502, 503, 504 - Server Errors | Something went wrong on Linkredirector's end. |
POST
request to /v1/links
with a JSON containing the attribute url
with the url to your product.{"url" : "http://www.amazon.com/dp/1936661837"}
curl -u API_KEY_GOES_HERE: \ -H "Content-Type: application/json" \ -X POST -d '{"url":"http://www.amazon.com/dp/1936661837"}' \ https://api.linkredirector.com/v1/links
{ "result" : { "link" : "http://lrd.to/skp2kSs" } }
{ "error":{ "code" : "authentication_failed", "description" : "Valid API key is missing." } }
<?php $linkredirector_secret_api_key = 'API_KEY_GOES_HERE'; $data = array('url'=>'http://www.amazon.com/Traction-Get-Grip-Your-Business/dp/1936661837'); $post_json = json_encode($data); $ch = curl_init("https://api.linkredirector.com/v1/links"); curl_setopt($ch, CURLOPT_USERPWD, $linkredirector_secret_api_key . ':'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($post_json)) ); $result = curl_exec($ch); curl_close($ch); ?>
import requests import json linkredirector_secret_api_key = 'API_KEY_GOES_HERE' data = {'url' : 'http://www.amazon.com/Traction-Get-Grip-Your-Business/dp/1936661837'} r = requests.post( 'https://api.linkredirector.com/v1/links', data=json.dumps(data), headers={"Content-Type": "application/json"}, auth=(linkredirector_secret_api_key,''), )