Functionality | Upload Links to Link Centaur | |
Endpoint Url | https://www.linkcentaur.com/api/newlinks.json | |
Http Method | POST | |
Content Type | The parameters must be passed to the api as form parameters (Content-Type: application/x-www-form-urlencoded) | |
Parameters | apikey | The user's API KEY, which can be found under Account Settings |
links |
A string representing the urls to be added to the system, separated by a single pipe character |
Example: http://www.example.org/link1|http://foo.com/bar|http://mysite.com/A Ampersand characters need to be URL encoded, so one correct form for http://example.com?A=B&C=D is http://example.com?A=B%26C=D |
|
campaign | The name of the campaign the links will be added to. If omitted it is set to "My Campaign" | |
drip_x_links_per_day | Sets the number of links per day, optional | |
drip_x_days | Sets the number days to drip the links over, optional | |
If neither drip_x_links_per_day nor drip_x_days are given as parameters, all the links are scheduled for immediate processing |
Format | JSON | |
Parameters | status |
|
details | Detailed response |
{"status":"ok","details":"400 links added successfully to the campaign New Campaign"}Failure :
{"status":"error","details":"Wrong API Key"}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?php $apikey='API_KEY'; $campaign='CAMPAIGN_NAME'; $urls=array('http://www.site1.com','http://www.site2.com/'); $urls = array_map('urlencode' , $urls); // optional fields // $drip_x_links_per_day = 50; // or // $drip_x_days = 7; $q = 'apikey='.$apikey; $q = $q.'&campaign='.$campaign; $q = $q.'&links='.implode('|',$urls); //$q = $q.'&drip_x_links_per_day='.$drip_x_links_per_day; //$q = $q.'&drip_x_days='.$drip_x_days; $ch = curl_init(); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_URL,'http://www.linkcentaur.com/api/newlinks.json'); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_TIMEOUT,60); curl_setopt($ch,CURLOPT_POSTFIELDS,$q); curl_exec($ch); curl_close($ch); ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # first run "gem install rest-client" or add "gem 'rest-client' to your Gemfile" require 'rest-client' require 'json' apikey = 'API_KEY' campaign = 'CAMPAIGN_NAME' links = %w{http://www.example.org/link1 , http://foo.com/bar , http://mysite.com/A} # optional fields # drip_x_links_per_day = 50 # or # drip_x_days = 7 response = RestClient.post 'http://www.linkcentaur.com/api/newlinks.json', :apikey => apikey, :campaign => campaign, :links => links.join("|") # , # :drip_x_links_per_day => drip_x_links_per_day #, :drip_x_days => drip_x_days results = JSON.parse(response.to_str) if results['status'] == "ok" p "Success !" else p "Failure !" end p results['details'] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | // Code Sample for .NET 4.0 using System; using System.Collections.Generic; using System.IO; using System.Net; // Example using JSON Deserialization with JSON.NET using Newtonsoft.Json.Linq; namespace LinkCentaur_API { class Program { static void Main(string[] args) { string apikey= "API_KEY"; string campaign = "CAMPAIGN_NAME"; string apiUrl = "https://www.linkcentaur.com/api/newlinks.json" ; List<string> links = new List<string>() { "http://www.example.org/link1", "http://foo.com/bar","http://mysite.com/A" }; // optional fields // int drip_x_links_per_day = 50; // or // int drip_x_days = 7; string q = "apikey=" + apikey; q += "&campaign=" + campaign; q += "&links=" + string.Join("|", links); // q += "&drip_x_links_per_day=" + drip_x_links_per_day; // q += "&drip_x_days=" + drip_x_days; HttpWebRequest req = WebRequest.Create(new Uri(apiUrl)) as HttpWebRequest; req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.Timeout = 60000; req.ReadWriteTimeout = 60000; StreamWriter sw = new StreamWriter(req.GetRequestStream()); sw.Write(q); sw.Close(); string result = null; using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse) { StreamReader reader = new StreamReader(resp.GetResponseStream()); result = reader.ReadToEnd(); reader.Close(); } JObject o = JObject.Parse(result); string status = (string) o["status"]; string details = (string) o["details"]; if(status == "ok") { Console.WriteLine("Success !"); } else { Console.WriteLine("Failure !"); } Console.WriteLine(details); } } } |
Functionality | Get plan usage details | |
Endpoint Url | http://www.linkcentaur.com/api/quota.json | |
Http Method | POST | |
Content Type | The parameters must be passed to the api as form parameters (Content-Type: application/x-www-form-urlencoded) | |
Parameters | apikey | The user's API KEY, which can be found under Account Settings |
Format | JSON | |
Parameters | status |
|
usage | Number of links posted today | |
limit | Number of links allowed daily under the user's current plan |
{"status":"ok","usage":154944,"limit":500000}Failure :
{"status":"api_key_error","usage":null,"limit":null}