linkemperor-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +59 -0
- data/Rakefile +2 -0
- data/lib/linkemperor-api/customers.rb +470 -0
- data/lib/linkemperor-api/vendors.rb +193 -0
- data/lib/linkemperor-api/version.rb +5 -0
- data/lib/linkemperor-api.rb +4 -0
- data/linkemperor-api.gemspec +17 -0
- data/php/customers.php +450 -0
- data/php/vendors.php +173 -0
- metadata +57 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
class LinkemperorVendor
|
7
|
+
class LinkemperorApiException < RuntimeError
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(api_key, base_path = nil)
|
11
|
+
@base_path = base_path || 'http://app.linkemperor.com'
|
12
|
+
@api_key = api_key
|
13
|
+
end
|
14
|
+
|
15
|
+
def exec_get(uri)
|
16
|
+
uri = URI(uri)
|
17
|
+
result = Net::HTTP.get_response(uri)
|
18
|
+
if result.is_a?(Net::HTTPSuccess)
|
19
|
+
JSON.parse(result.body)
|
20
|
+
else
|
21
|
+
raise LinkemperorApiException.new result.body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def exec_post(parameters, method, uri)
|
26
|
+
uri = URI(uri)
|
27
|
+
req = case method
|
28
|
+
when 'put'
|
29
|
+
Net::HTTP::Put.new(uri.request_uri)
|
30
|
+
when 'post'
|
31
|
+
Net::HTTP::Post.new(uri.request_uri)
|
32
|
+
when 'delete'
|
33
|
+
Net::HTTP::Delete.new(uri.request_uri)
|
34
|
+
end
|
35
|
+
req.body = JSON.dump(parameters)
|
36
|
+
req.content_type = "application/json"
|
37
|
+
result = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
38
|
+
http.request(req)
|
39
|
+
end
|
40
|
+
#result = Net::HTTP.post_form(uri, converted_params)
|
41
|
+
if result.is_a?(Net::HTTPSuccess)
|
42
|
+
if result.body == 'false'
|
43
|
+
false
|
44
|
+
elsif result.body == 'true'
|
45
|
+
true
|
46
|
+
else
|
47
|
+
if method != 'delete'
|
48
|
+
JSON.parse(result.body)
|
49
|
+
else
|
50
|
+
result.body
|
51
|
+
end
|
52
|
+
end
|
53
|
+
else
|
54
|
+
raise LinkemperorApiException.new result.body
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# We call orders placed for your link building Service a Blast.
|
60
|
+
# Use this method to retrieve all outstanding orders for your link building service(s).
|
61
|
+
#
|
62
|
+
# We will respond with the 500 first outstanding blasts for either the provided Service ID, or if none is provided, for all of your Services.
|
63
|
+
# Parameters:
|
64
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
65
|
+
def get_blasts(service_id = nil)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
exec_get("#{@base_path}/api/v2/vendors/blasts.json?api_key=#{@api_key}")
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# Pulls the next blast from the order queue, marks it as having been started,
|
75
|
+
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
76
|
+
# Parameters:
|
77
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
78
|
+
def get_next_blast(service_id = nil)
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
exec_get("#{@base_path}/api/v2/vendors/blasts/next.json?api_key=#{@api_key}")
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
# Pulls a batch of blast from the order queue, marks them as having been started,
|
88
|
+
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
89
|
+
# Parameters:
|
90
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
91
|
+
# - batch_size: Batch size. If not provided, the default batch size is 100
|
92
|
+
def get_next_batch_blasts(service_id = nil, batch_size = nil)
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
exec_get("#{@base_path}/api/v2/vendors/blasts/next_batch.json?api_key=#{@api_key}")
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# Once you've completed link building for a request, you need to submit the URLs where links were built. This PUT method does that.
|
102
|
+
#
|
103
|
+
# After we receive this submission, we will verify the links provided within 24 hours.
|
104
|
+
# Once the links prove to be valid, we will credit your account immediately. If we cannot
|
105
|
+
# find enough valid backlinks in the links that you provided, we will suspend payment pending a manual review.
|
106
|
+
# Parameters:
|
107
|
+
# - id: ID # of the Blast
|
108
|
+
# - links: A string containing the list of links to submit (newline delimited)
|
109
|
+
def submit_built_link(id, links)
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
if id.nil?
|
114
|
+
raise LinkemperorApiException.new('id should not be empty')
|
115
|
+
end
|
116
|
+
|
117
|
+
if links.nil?
|
118
|
+
raise LinkemperorApiException.new('links should not be empty')
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
parameters = {'blast' => {'links' => links}}
|
123
|
+
exec_post(parameters, 'put', "#{@base_path}/api/v2/vendors/blasts/#{id}.json?api_key=#{@api_key}")
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
# Lists all available Services. This is a great way to automatically compare your service against the current competition.
|
128
|
+
# Parameters:
|
129
|
+
# none
|
130
|
+
def get_services()
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
exec_get("#{@base_path}/api/v2/vendors/services.json?api_key=#{@api_key}")
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
# Lists the full details of a specific Service.
|
140
|
+
# Parameters:
|
141
|
+
# - id: ID # of the Service
|
142
|
+
def get_service_by_id(id)
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
if id.nil?
|
147
|
+
raise LinkemperorApiException.new('id should not be empty')
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
exec_get("#{@base_path}/api/v2/vendors/services/#{id}.json?api_key=#{@api_key}")
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
# This API method looks at all the Built URLs submitted to a given Service in the last 7 days and finds domains that have never passed our link checker.
|
156
|
+
#
|
157
|
+
# This is a great way to clean your list of URLs used for submissions.
|
158
|
+
# Parameters:
|
159
|
+
# - id: ID # of the Service
|
160
|
+
def get_failed_domains(id)
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
if id.nil?
|
165
|
+
raise LinkemperorApiException.new('id should not be empty')
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
exec_get("#{@base_path}/api/v2/vendors/services/#{id}/failed_domains.json?api_key=#{@api_key}")
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
# Creates a test blast for your Service. It will not affect your score or marketplace rank. However, if you submit URLs that fail to pass our link checker, they will be reflected in the failed_domains method of the API.
|
174
|
+
#
|
175
|
+
# This is particularly useful for testing new URL lists or potential link sources.
|
176
|
+
# Parameters:
|
177
|
+
# - id: ID # of the Service
|
178
|
+
def create_test_blast(id)
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
if id.nil?
|
183
|
+
raise LinkemperorApiException.new('id should not be empty')
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
parameters = {}
|
188
|
+
exec_post(parameters, 'post', "#{@base_path}/api/v2/vendors/services/#{id}/test_blast.json?api_key=#{@api_key}")
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/linkemperor-api/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["LinkEmperor"]
|
6
|
+
gem.email = ["linkemperor@linkemperor.com"]
|
7
|
+
gem.description = %q{Link Emperor API for Customers and Vendors}
|
8
|
+
gem.summary = %q{Link Emperor API}
|
9
|
+
gem.homepage = "http://www.linkemperor.com"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "linkemperor-api"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Linkemperor::Api::VERSION
|
17
|
+
end
|
data/php/customers.php
ADDED
@@ -0,0 +1,450 @@
|
|
1
|
+
|
2
|
+
<?php
|
3
|
+
class LinkemperorCustomer {
|
4
|
+
function __construct($api_key) {
|
5
|
+
$this->api_key = $api_key;
|
6
|
+
$this->base_path = 'http://app.linkemperor.com';
|
7
|
+
}
|
8
|
+
function linkemperor_exec($post_data, $method_type, $uri) {
|
9
|
+
$ch = curl_init();
|
10
|
+
curl_setopt($ch, CURLOPT_URL, $this->base_path . $uri);
|
11
|
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
12
|
+
curl_setopt($ch, CURLOPT_USERPWD, $this->api_key . ":x");
|
13
|
+
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
14
|
+
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json"));
|
15
|
+
if ($post_data) {
|
16
|
+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
|
17
|
+
}
|
18
|
+
if ($method_type) {
|
19
|
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method_type);
|
20
|
+
}
|
21
|
+
$data = curl_exec($ch);
|
22
|
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
23
|
+
if ($http_code >= 200 && $http_code < 300) {
|
24
|
+
if (strlen($data)) {
|
25
|
+
$json = json_decode($data);
|
26
|
+
return $json;
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
throw new Exception($data);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
# This method creates a new Article.
|
39
|
+
# Parameters:
|
40
|
+
# - campaign_id: Campaign ID for this Article
|
41
|
+
# - title: Article Title (Spintax OK)
|
42
|
+
# - body: Article Body (Spintax OK)
|
43
|
+
public function create_article($campaign_id, $title, $body) {
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
if(!$campaign_id) {
|
48
|
+
throw new Exception('campaign_id should not be empty');
|
49
|
+
}
|
50
|
+
|
51
|
+
if(!$title) {
|
52
|
+
throw new Exception('title should not be empty');
|
53
|
+
}
|
54
|
+
|
55
|
+
if(!$body) {
|
56
|
+
throw new Exception('body should not be empty');
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
$parameters = array('article' => array('campaign_id' => $campaign_id, 'title' => $title, 'body' => $body));
|
61
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/articles.json");
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
# This method deletes the Article you specify.
|
66
|
+
# Parameters:
|
67
|
+
# - id: Article ID
|
68
|
+
public function delete_article($id) {
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
if(!$id) {
|
73
|
+
throw new Exception('id should not be empty');
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
$parameters = array();
|
78
|
+
return $this->linkemperor_exec($parameters, 'DELETE', "/api/v2/customers/articles/$id.json");
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
# This method returns a list of Articles for the Campaign.
|
83
|
+
# Parameters:
|
84
|
+
# - id: Campaign ID
|
85
|
+
public function get_campaign_articles($id) {
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
if(!$id) {
|
90
|
+
throw new Exception('id should not be empty');
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/campaigns/$id/articles.json");
|
95
|
+
|
96
|
+
}
|
97
|
+
|
98
|
+
# This method returns a list of all the Blasts that exist on your account.
|
99
|
+
# Parameters:
|
100
|
+
# none
|
101
|
+
public function get_blasts() {
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/blasts.json");
|
107
|
+
|
108
|
+
}
|
109
|
+
|
110
|
+
# This method returns a details about the Blast you specify
|
111
|
+
# Parameters:
|
112
|
+
# - id: Blast ID
|
113
|
+
public function get_blast_by_id($id) {
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
if(!$id) {
|
118
|
+
throw new Exception('id should not be empty');
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/blasts/$id.json");
|
123
|
+
|
124
|
+
}
|
125
|
+
|
126
|
+
# This method returns a list of the Blasts in the Campaign.
|
127
|
+
# Parameters:
|
128
|
+
# - id: Campaign ID
|
129
|
+
public function get_campaign_blasts($id) {
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
if(!$id) {
|
134
|
+
throw new Exception('id should not be empty');
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/campaigns/$id/blasts.json");
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
# This method creates a new campaign. Remember that if you exceed your plan limit on Campaigns, there may be additional charges.
|
143
|
+
# Parameters:
|
144
|
+
# - name: Name of the Campaign.
|
145
|
+
# - notes: Notes
|
146
|
+
public function create_campaign($name, $notes = null) {
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
if(!$name) {
|
151
|
+
throw new Exception('name should not be empty');
|
152
|
+
}
|
153
|
+
|
154
|
+
|
155
|
+
$parameters = array('campaign' => array('name' => $name, 'notes' => $notes));
|
156
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/campaigns.json");
|
157
|
+
|
158
|
+
}
|
159
|
+
|
160
|
+
# This method deletes the Campaign you specify.
|
161
|
+
# Parameters:
|
162
|
+
# - id: Campaign ID
|
163
|
+
public function delete_campaign($id) {
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
if(!$id) {
|
168
|
+
throw new Exception('id should not be empty');
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
$parameters = array();
|
173
|
+
return $this->linkemperor_exec($parameters, 'DELETE', "/api/v2/customers/campaigns/$id.json");
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
# This method returns a list of the Sites in the Campaign.
|
178
|
+
# Parameters:
|
179
|
+
# - id: Campaign ID
|
180
|
+
public function get_campaign_sites($id) {
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
if(!$id) {
|
185
|
+
throw new Exception('id should not be empty');
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/campaigns/$id/sites.json");
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
# This method returns a list of the Targets in the Campaign.
|
194
|
+
# Parameters:
|
195
|
+
# - id: Campaign ID
|
196
|
+
public function get_campaign_targets($id) {
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
if(!$id) {
|
201
|
+
throw new Exception('id should not be empty');
|
202
|
+
}
|
203
|
+
|
204
|
+
|
205
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/campaigns/$id/targets.json");
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
# This method returns a list of Trouble Spots for the Campaign.
|
210
|
+
# Parameters:
|
211
|
+
# - id: Campaign ID
|
212
|
+
public function get_campaign_trouble_spots($id) {
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
if(!$id) {
|
217
|
+
throw new Exception('id should not be empty');
|
218
|
+
}
|
219
|
+
|
220
|
+
|
221
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/campaigns/$id/trouble_spots.json");
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
# This method is used to purchase link building.<br /><br />
|
226
|
+
# We call a single purchase an Order, and each order can contain multiple Blasts.<br /><br />
|
227
|
+
# First, you'll need to determine which of our link building Services you'd like to order. Use the /services endpoint of the API to get a list of available services.<br /><br />
|
228
|
+
# Now let's talk about building the actual order. An OrderRequest specifies the Services to order and the Targets (URL/anchor text) to build links to. Each Order can have multiple OrderRequests.<br /><br />
|
229
|
+
# You can see a sample OrderRequest (in JSON) by clicking "Model Schema" under the "Schema Used In Your Request" section just below.
|
230
|
+
# Parameters:
|
231
|
+
# - how_pay: How to pay for the Order. 'cash' to generate an invoice that will be settled against your account on file, or 'credits' to pull from the pool of existing credits in your account.
|
232
|
+
# - callback_url: The URL to notify when the status of the Order is updated. This occurs when component Blasts either succeed (and URLs are available for viewing) or fail (and replacement Blasts have been ordered.)
|
233
|
+
# - custom: You may provide any string here. We will save it as part of the Order and include it in the returned data whenever you check on an Order's status. It's great for holding your internal ID number for the Order.
|
234
|
+
# - requests: This is where the actual object describing your order goes. This is either a JSON nested array or XML nested tags (depending on your current format). The schema for this field is described below in the section titled Schema Used In Your Request.
|
235
|
+
public function create_order($requests, $how_pay = null, $callback_url = null, $custom = null) {
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
if(!$requests) {
|
240
|
+
throw new Exception('requests should not be empty');
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
$parameters = array('order' => array('how_pay' => $how_pay, 'callback_url' => $callback_url, 'custom' => $custom, 'requests' => $requests));
|
245
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/orders.json");
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
# This method shows the details of an Order and its component Blasts.<be /><be />
|
250
|
+
# It's a great way to check on an order or obtain a list of Built URLs to report back to your systems.
|
251
|
+
# Parameters:
|
252
|
+
# - id: ID # of the Order
|
253
|
+
public function get_order_by_id($id) {
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
if(!$id) {
|
258
|
+
throw new Exception('id should not be empty');
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/orders/$id.json");
|
263
|
+
|
264
|
+
}
|
265
|
+
|
266
|
+
# If you're going to order link building, you need to check which Services are currently available.<br /><br />
|
267
|
+
# This list will change on a day-to-day or even minute-to-minute basis,
|
268
|
+
# so please look up the Services list to determine the best Services to order before placing an Order.<br /><br />
|
269
|
+
# This method returns a list of the currently available Services.
|
270
|
+
# Parameters:
|
271
|
+
# none
|
272
|
+
public function get_services() {
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/services.json");
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
# This method returns a list of the currently available Services that
|
282
|
+
# cdon't build links on Adult or other potentially objectional sites.
|
283
|
+
# Parameters:
|
284
|
+
# none
|
285
|
+
public function get_safe_services() {
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/services/safe.json");
|
291
|
+
|
292
|
+
}
|
293
|
+
|
294
|
+
# This method creates a new Site.
|
295
|
+
# Parameters:
|
296
|
+
# - campaign_id: Campaign ID for this Site
|
297
|
+
# - name: Name of this Site.
|
298
|
+
# - domain_name: Domain Name of this Site
|
299
|
+
# - rss_feed: RSS Feed for this Site
|
300
|
+
public function create_site($campaign_id, $name, $domain_name, $rss_feed = null) {
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
if(!$campaign_id) {
|
305
|
+
throw new Exception('campaign_id should not be empty');
|
306
|
+
}
|
307
|
+
|
308
|
+
if(!$name) {
|
309
|
+
throw new Exception('name should not be empty');
|
310
|
+
}
|
311
|
+
|
312
|
+
if(!$domain_name) {
|
313
|
+
throw new Exception('domain_name should not be empty');
|
314
|
+
}
|
315
|
+
|
316
|
+
|
317
|
+
$parameters = array('site' => array('campaign_id' => $campaign_id, 'name' => $name, 'domain_name' => $domain_name, 'rss_feed' => $rss_feed));
|
318
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/sites.json");
|
319
|
+
|
320
|
+
}
|
321
|
+
|
322
|
+
# This method deletes the Site you specify.
|
323
|
+
# Parameters:
|
324
|
+
# - id: Site ID
|
325
|
+
public function delete_site($id) {
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
if(!$id) {
|
330
|
+
throw new Exception('id should not be empty');
|
331
|
+
}
|
332
|
+
|
333
|
+
|
334
|
+
$parameters = array();
|
335
|
+
return $this->linkemperor_exec($parameters, 'DELETE', "/api/v2/customers/sites/$id.json");
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
# This method creates a new Target. You will need to provide a Campaign ID and a URL for the target.
|
340
|
+
# Parameters:
|
341
|
+
# - campaign_id: Campaign ID
|
342
|
+
# - url_input: Fully qualified URL for the target.
|
343
|
+
# - keyword_input: Keywords to add to the target. Separate multiple keywords with linebreaks.
|
344
|
+
public function create_target($campaign_id, $url_input, $keyword_input = null) {
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
if(!$campaign_id) {
|
349
|
+
throw new Exception('campaign_id should not be empty');
|
350
|
+
}
|
351
|
+
|
352
|
+
if(!$url_input) {
|
353
|
+
throw new Exception('url_input should not be empty');
|
354
|
+
}
|
355
|
+
|
356
|
+
|
357
|
+
$parameters = array('target' => array('campaign_id' => $campaign_id, 'url_input' => $url_input, 'keyword_input' => $keyword_input));
|
358
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/targets.json");
|
359
|
+
|
360
|
+
}
|
361
|
+
|
362
|
+
# This method deletes the Target you specify.
|
363
|
+
# Parameters:
|
364
|
+
# - id: Target ID
|
365
|
+
public function delete_target($id) {
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
if(!$id) {
|
370
|
+
throw new Exception('id should not be empty');
|
371
|
+
}
|
372
|
+
|
373
|
+
|
374
|
+
$parameters = array();
|
375
|
+
return $this->linkemperor_exec($parameters, 'DELETE', "/api/v2/customers/targets/$id.json");
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
# This method creates a new Keyword. You will need to provide a Target ID.
|
380
|
+
# Parameters:
|
381
|
+
# - target_id: Target ID
|
382
|
+
# - keyword_string: Keyword string
|
383
|
+
public function create_target_keyword($target_id, $keyword_string) {
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
if(!$target_id) {
|
388
|
+
throw new Exception('target_id should not be empty');
|
389
|
+
}
|
390
|
+
|
391
|
+
if(!$keyword_string) {
|
392
|
+
throw new Exception('keyword_string should not be empty');
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
$parameters = array('target_keyword' => array('target_id' => $target_id, 'keyword_string' => $keyword_string));
|
397
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/customers/target_keywords.json");
|
398
|
+
|
399
|
+
}
|
400
|
+
|
401
|
+
# This method deletes the Keyword you specify.
|
402
|
+
# Parameters:
|
403
|
+
# - id: Keyword ID
|
404
|
+
public function delete_target_keyword($id) {
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
if(!$id) {
|
409
|
+
throw new Exception('id should not be empty');
|
410
|
+
}
|
411
|
+
|
412
|
+
|
413
|
+
$parameters = array();
|
414
|
+
return $this->linkemperor_exec($parameters, 'DELETE', "/api/v2/customers/target_keywords/$id.json");
|
415
|
+
|
416
|
+
}
|
417
|
+
|
418
|
+
# This method returns a list of all the Trouble Spots that exist on your account.
|
419
|
+
#
|
420
|
+
# Trouble Spots are issues spotted by our On-Page SEO Checker for Campaigns.
|
421
|
+
# Parameters:
|
422
|
+
# none
|
423
|
+
public function get_trouble_spots() {
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/trouble_spots.json");
|
429
|
+
|
430
|
+
}
|
431
|
+
|
432
|
+
# This method returns details about the Trouble Spot you specify.
|
433
|
+
# Parameters:
|
434
|
+
# - id: TroubleSpot ID
|
435
|
+
public function get_trouble_spot_by_id($id) {
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
if(!$id) {
|
440
|
+
throw new Exception('id should not be empty');
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
return $this->linkemperor_exec(null, null,"/api/v2/customers/trouble_spots/$id.json");
|
445
|
+
|
446
|
+
}
|
447
|
+
|
448
|
+
}
|
449
|
+
?>
|
450
|
+
|