linkemperor-api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -17
- data/lib/linkemperor-api/customers.rb +130 -180
- data/lib/linkemperor-api/vendors.rb +21 -57
- data/lib/linkemperor-api/version.rb +1 -1
- metadata +2 -4
- data/php/customers.php +0 -450
- data/php/vendors.php +0 -173
data/README.md
CHANGED
@@ -18,8 +18,6 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
### Ruby
|
22
|
-
|
23
21
|
Include the gem on your project and use it like this:
|
24
22
|
|
25
23
|
require 'linkemperor-api'
|
@@ -32,21 +30,6 @@ Include the gem on your project and use it like this:
|
|
32
30
|
api = LinkemperorVendor.new('<api_key>')
|
33
31
|
api.desired_method
|
34
32
|
|
35
|
-
### PHP
|
36
|
-
|
37
|
-
Include the files under the 'php' directory and use it as follow:
|
38
|
-
|
39
|
-
include('customers.php');
|
40
|
-
include('vendors.php');
|
41
|
-
|
42
|
-
# Customers
|
43
|
-
$api = new LinkemperorCustomer("<api key>");
|
44
|
-
$api->some_method();
|
45
|
-
|
46
|
-
# Vendors
|
47
|
-
$api = new LinkemperorVendor("<api key>");
|
48
|
-
$api->some_method();
|
49
|
-
|
50
33
|
For details on the available operations, check documentation available on
|
51
34
|
http://www.linkemperor.com/api-documentation
|
52
35
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'net/http'
|
3
2
|
require 'uri'
|
4
3
|
require 'json'
|
@@ -55,194 +54,163 @@ class LinkemperorCustomer
|
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
|
-
|
57
|
+
|
58
|
+
# This method returns a list of all the Articles that exist on your account.
|
59
|
+
# Parameters:
|
60
|
+
# none
|
61
|
+
def get_articles()
|
62
|
+
exec_get("#{@base_path}/api/v2/customers/articles.json?api_key=#{@api_key}")
|
63
|
+
end
|
64
|
+
|
65
|
+
# This method returns details about the Article you specify.
|
66
|
+
# Parameters:
|
67
|
+
# - id: Article ID
|
68
|
+
def get_articles_by_id(id)
|
69
|
+
if id.nil?
|
70
|
+
raise LinkemperorApiException.new('id should not be empty')
|
71
|
+
end
|
72
|
+
exec_get("#{@base_path}/api/v2/customers/articles/#{id}.json?api_key=#{@api_key}")
|
73
|
+
end
|
74
|
+
|
59
75
|
# This method creates a new Article.
|
60
76
|
# Parameters:
|
61
77
|
# - campaign_id: Campaign ID for this Article
|
62
78
|
# - title: Article Title (Spintax OK)
|
63
79
|
# - body: Article Body (Spintax OK)
|
64
80
|
def create_article(campaign_id, title, body)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
81
|
if campaign_id.nil?
|
69
82
|
raise LinkemperorApiException.new('campaign_id should not be empty')
|
70
83
|
end
|
71
|
-
|
84
|
+
|
72
85
|
if title.nil?
|
73
86
|
raise LinkemperorApiException.new('title should not be empty')
|
74
87
|
end
|
75
|
-
|
88
|
+
|
76
89
|
if body.nil?
|
77
90
|
raise LinkemperorApiException.new('body should not be empty')
|
78
91
|
end
|
79
|
-
|
80
|
-
|
81
92
|
parameters = {'article' => {'campaign_id' => campaign_id, 'title' => title, 'body' => body}}
|
82
93
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/articles.json?api_key=#{@api_key}")
|
83
|
-
|
84
94
|
end
|
85
|
-
|
95
|
+
|
86
96
|
# This method deletes the Article you specify.
|
87
97
|
# Parameters:
|
88
98
|
# - id: Article ID
|
89
99
|
def delete_article(id)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
100
|
if id.nil?
|
94
101
|
raise LinkemperorApiException.new('id should not be empty')
|
95
102
|
end
|
96
|
-
|
97
|
-
|
98
103
|
parameters = {}
|
99
104
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/articles/#{id}.json?api_key=#{@api_key}")
|
100
|
-
|
101
105
|
end
|
102
|
-
|
106
|
+
|
103
107
|
# This method returns a list of Articles for the Campaign.
|
104
108
|
# Parameters:
|
105
109
|
# - id: Campaign ID
|
106
110
|
def get_campaign_articles(id)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
111
|
if id.nil?
|
111
112
|
raise LinkemperorApiException.new('id should not be empty')
|
112
113
|
end
|
113
|
-
|
114
|
-
|
115
114
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/articles.json?api_key=#{@api_key}")
|
116
|
-
|
117
115
|
end
|
118
|
-
|
116
|
+
|
119
117
|
# This method returns a list of all the Blasts that exist on your account.
|
120
118
|
# Parameters:
|
121
119
|
# none
|
122
120
|
def get_blasts()
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
121
|
exec_get("#{@base_path}/api/v2/customers/blasts.json?api_key=#{@api_key}")
|
128
|
-
|
129
122
|
end
|
130
|
-
|
123
|
+
|
131
124
|
# This method returns a details about the Blast you specify
|
132
125
|
# Parameters:
|
133
126
|
# - id: Blast ID
|
134
127
|
def get_blast_by_id(id)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
128
|
if id.nil?
|
139
129
|
raise LinkemperorApiException.new('id should not be empty')
|
140
130
|
end
|
141
|
-
|
142
|
-
|
143
131
|
exec_get("#{@base_path}/api/v2/customers/blasts/#{id}.json?api_key=#{@api_key}")
|
144
|
-
|
145
132
|
end
|
146
|
-
|
133
|
+
|
147
134
|
# This method returns a list of the Blasts in the Campaign.
|
148
135
|
# Parameters:
|
149
136
|
# - id: Campaign ID
|
150
137
|
def get_campaign_blasts(id)
|
151
|
-
|
152
|
-
|
153
|
-
|
154
138
|
if id.nil?
|
155
139
|
raise LinkemperorApiException.new('id should not be empty')
|
156
140
|
end
|
157
|
-
|
158
|
-
|
159
141
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/blasts.json?api_key=#{@api_key}")
|
160
|
-
|
161
142
|
end
|
162
|
-
|
163
|
-
# This method
|
143
|
+
|
144
|
+
# This method returns a list of all the Campagins that exist on your account.
|
164
145
|
# Parameters:
|
165
|
-
#
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
if name.nil?
|
172
|
-
raise LinkemperorApiException.new('name should not be empty')
|
173
|
-
end
|
174
|
-
|
175
|
-
|
176
|
-
parameters = {'campaign' => {'name' => name, 'notes' => notes}}
|
177
|
-
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/campaigns.json?api_key=#{@api_key}")
|
178
|
-
|
146
|
+
# none
|
147
|
+
def get_campaigns()
|
148
|
+
exec_get("#{@base_path}/api/v2/customers/campaigns.json?api_key=#{@api_key}")
|
179
149
|
end
|
180
|
-
|
181
|
-
# This method
|
150
|
+
|
151
|
+
# This method returns details about the campaign you specify.
|
182
152
|
# Parameters:
|
183
153
|
# - id: Campaign ID
|
184
|
-
def
|
185
|
-
|
186
|
-
|
187
|
-
|
154
|
+
def get_campaign_by_id(id)
|
188
155
|
if id.nil?
|
189
156
|
raise LinkemperorApiException.new('id should not be empty')
|
190
157
|
end
|
191
|
-
|
192
|
-
|
193
|
-
parameters = {}
|
194
|
-
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
195
|
-
|
158
|
+
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
196
159
|
end
|
197
|
-
|
160
|
+
|
198
161
|
# This method returns a list of the Sites in the Campaign.
|
199
162
|
# Parameters:
|
200
163
|
# - id: Campaign ID
|
201
164
|
def get_campaign_sites(id)
|
202
|
-
|
203
|
-
|
204
|
-
|
205
165
|
if id.nil?
|
206
166
|
raise LinkemperorApiException.new('id should not be empty')
|
207
167
|
end
|
208
|
-
|
209
|
-
|
210
168
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/sites.json?api_key=#{@api_key}")
|
211
|
-
|
212
169
|
end
|
213
|
-
|
170
|
+
|
214
171
|
# This method returns a list of the Targets in the Campaign.
|
215
172
|
# Parameters:
|
216
173
|
# - id: Campaign ID
|
217
174
|
def get_campaign_targets(id)
|
218
|
-
|
219
|
-
|
220
|
-
|
221
175
|
if id.nil?
|
222
176
|
raise LinkemperorApiException.new('id should not be empty')
|
223
177
|
end
|
224
|
-
|
225
|
-
|
226
178
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/targets.json?api_key=#{@api_key}")
|
227
|
-
|
228
179
|
end
|
229
|
-
|
180
|
+
|
230
181
|
# This method returns a list of Trouble Spots for the Campaign.
|
231
182
|
# Parameters:
|
232
183
|
# - id: Campaign ID
|
233
184
|
def get_campaign_trouble_spots(id)
|
234
|
-
|
235
|
-
|
236
|
-
|
237
185
|
if id.nil?
|
238
186
|
raise LinkemperorApiException.new('id should not be empty')
|
239
187
|
end
|
240
|
-
|
241
|
-
|
242
188
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/trouble_spots.json?api_key=#{@api_key}")
|
243
|
-
|
244
189
|
end
|
245
|
-
|
190
|
+
|
191
|
+
# This method creates a new campaign. Remember that if you exceed your plan limit on Campaigns, there may be additional charges.
|
192
|
+
# Parameters:
|
193
|
+
# - name: Name of the Campaign.
|
194
|
+
# - notes: Notes
|
195
|
+
def create_campaign(name, notes = nil)
|
196
|
+
if name.nil?
|
197
|
+
raise LinkemperorApiException.new('name should not be empty')
|
198
|
+
end
|
199
|
+
parameters = {'campaign' => {'name' => name, 'notes' => notes}}
|
200
|
+
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/campaigns.json?api_key=#{@api_key}")
|
201
|
+
end
|
202
|
+
|
203
|
+
# This method deletes the Campaign you specify.
|
204
|
+
# Parameters:
|
205
|
+
# - id: Campaign ID
|
206
|
+
def delete_campaign(id)
|
207
|
+
if id.nil?
|
208
|
+
raise LinkemperorApiException.new('id should not be empty')
|
209
|
+
end
|
210
|
+
parameters = {}
|
211
|
+
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
212
|
+
end
|
213
|
+
|
246
214
|
# This method is used to purchase link building.<br /><br />
|
247
215
|
# We call a single purchase an Order, and each order can contain multiple Blasts.<br /><br />
|
248
216
|
# 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 />
|
@@ -254,36 +222,24 @@ class LinkemperorCustomer
|
|
254
222
|
# - 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.
|
255
223
|
# - 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.
|
256
224
|
def create_order(requests, how_pay = nil, callback_url = nil, custom = nil)
|
257
|
-
|
258
|
-
|
259
|
-
|
260
225
|
if requests.nil?
|
261
226
|
raise LinkemperorApiException.new('requests should not be empty')
|
262
227
|
end
|
263
|
-
|
264
|
-
|
265
228
|
parameters = {'order' => {'how_pay' => how_pay, 'callback_url' => callback_url, 'custom' => custom, 'requests' => requests}}
|
266
229
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/orders.json?api_key=#{@api_key}")
|
267
|
-
|
268
230
|
end
|
269
|
-
|
231
|
+
|
270
232
|
# This method shows the details of an Order and its component Blasts.<be /><be />
|
271
233
|
# It's a great way to check on an order or obtain a list of Built URLs to report back to your systems.
|
272
234
|
# Parameters:
|
273
235
|
# - id: ID # of the Order
|
274
236
|
def get_order_by_id(id)
|
275
|
-
|
276
|
-
|
277
|
-
|
278
237
|
if id.nil?
|
279
238
|
raise LinkemperorApiException.new('id should not be empty')
|
280
239
|
end
|
281
|
-
|
282
|
-
|
283
240
|
exec_get("#{@base_path}/api/v2/customers/orders/#{id}.json?api_key=#{@api_key}")
|
284
|
-
|
285
241
|
end
|
286
|
-
|
242
|
+
|
287
243
|
# If you're going to order link building, you need to check which Services are currently available.<br /><br />
|
288
244
|
# This list will change on a day-to-day or even minute-to-minute basis,
|
289
245
|
# so please look up the Services list to determine the best Services to order before placing an Order.<br /><br />
|
@@ -291,27 +247,34 @@ class LinkemperorCustomer
|
|
291
247
|
# Parameters:
|
292
248
|
# none
|
293
249
|
def get_services()
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
250
|
exec_get("#{@base_path}/api/v2/customers/services.json?api_key=#{@api_key}")
|
299
|
-
|
300
251
|
end
|
301
|
-
|
252
|
+
|
302
253
|
# This method returns a list of the currently available Services that
|
303
254
|
# cdon't build links on Adult or other potentially objectional sites.
|
304
255
|
# Parameters:
|
305
256
|
# none
|
306
257
|
def get_safe_services()
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
258
|
exec_get("#{@base_path}/api/v2/customers/services/safe.json?api_key=#{@api_key}")
|
312
|
-
|
313
259
|
end
|
314
|
-
|
260
|
+
|
261
|
+
# This method returns a list of all the Sites that exist on your account.
|
262
|
+
# Parameters:
|
263
|
+
# none
|
264
|
+
def get_sites()
|
265
|
+
exec_get("#{@base_path}/api/v2/customers/sites.json?api_key=#{@api_key}")
|
266
|
+
end
|
267
|
+
|
268
|
+
# This method returns details about the Site you specify.
|
269
|
+
# Parameters:
|
270
|
+
# - id: Site ID
|
271
|
+
def get_site_by_id(id)
|
272
|
+
if id.nil?
|
273
|
+
raise LinkemperorApiException.new('id should not be empty')
|
274
|
+
end
|
275
|
+
exec_get("#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}")
|
276
|
+
end
|
277
|
+
|
315
278
|
# This method creates a new Site.
|
316
279
|
# Parameters:
|
317
280
|
# - campaign_id: Campaign ID for this Site
|
@@ -319,152 +282,139 @@ class LinkemperorCustomer
|
|
319
282
|
# - domain_name: Domain Name of this Site
|
320
283
|
# - rss_feed: RSS Feed for this Site
|
321
284
|
def create_site(campaign_id, name, domain_name, rss_feed = nil)
|
322
|
-
|
323
|
-
|
324
|
-
|
325
285
|
if campaign_id.nil?
|
326
286
|
raise LinkemperorApiException.new('campaign_id should not be empty')
|
327
287
|
end
|
328
|
-
|
288
|
+
|
329
289
|
if name.nil?
|
330
290
|
raise LinkemperorApiException.new('name should not be empty')
|
331
291
|
end
|
332
|
-
|
292
|
+
|
333
293
|
if domain_name.nil?
|
334
294
|
raise LinkemperorApiException.new('domain_name should not be empty')
|
335
295
|
end
|
336
|
-
|
337
|
-
|
338
296
|
parameters = {'site' => {'campaign_id' => campaign_id, 'name' => name, 'domain_name' => domain_name, 'rss_feed' => rss_feed}}
|
339
297
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/sites.json?api_key=#{@api_key}")
|
340
|
-
|
341
298
|
end
|
342
|
-
|
299
|
+
|
343
300
|
# This method deletes the Site you specify.
|
344
301
|
# Parameters:
|
345
302
|
# - id: Site ID
|
346
303
|
def delete_site(id)
|
347
|
-
|
348
|
-
|
349
|
-
|
350
304
|
if id.nil?
|
351
305
|
raise LinkemperorApiException.new('id should not be empty')
|
352
306
|
end
|
353
|
-
|
354
|
-
|
355
307
|
parameters = {}
|
356
308
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}")
|
357
|
-
|
358
309
|
end
|
359
|
-
|
310
|
+
|
311
|
+
# This method returns a list of all the Targets that exist on your account (across all Campaigns).
|
312
|
+
# Parameters:
|
313
|
+
# none
|
314
|
+
def get_targets()
|
315
|
+
exec_get("#{@base_path}/api/v2/customers/targets.json?api_key=#{@api_key}")
|
316
|
+
end
|
317
|
+
|
318
|
+
# This method returns details about the Target you specify.
|
319
|
+
# Parameters:
|
320
|
+
# - id: Target ID
|
321
|
+
def get_target_by_id(id)
|
322
|
+
if id.nil?
|
323
|
+
raise LinkemperorApiException.new('id should not be empty')
|
324
|
+
end
|
325
|
+
exec_get("#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}")
|
326
|
+
end
|
327
|
+
|
360
328
|
# This method creates a new Target. You will need to provide a Campaign ID and a URL for the target.
|
361
329
|
# Parameters:
|
362
330
|
# - campaign_id: Campaign ID
|
363
331
|
# - url_input: Fully qualified URL for the target.
|
364
332
|
# - keyword_input: Keywords to add to the target. Separate multiple keywords with linebreaks.
|
365
333
|
def create_target(campaign_id, url_input, keyword_input = nil)
|
366
|
-
|
367
|
-
|
368
|
-
|
369
334
|
if campaign_id.nil?
|
370
335
|
raise LinkemperorApiException.new('campaign_id should not be empty')
|
371
336
|
end
|
372
|
-
|
337
|
+
|
373
338
|
if url_input.nil?
|
374
339
|
raise LinkemperorApiException.new('url_input should not be empty')
|
375
340
|
end
|
376
|
-
|
377
|
-
|
378
341
|
parameters = {'target' => {'campaign_id' => campaign_id, 'url_input' => url_input, 'keyword_input' => keyword_input}}
|
379
342
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/targets.json?api_key=#{@api_key}")
|
380
|
-
|
381
343
|
end
|
382
|
-
|
344
|
+
|
383
345
|
# This method deletes the Target you specify.
|
384
346
|
# Parameters:
|
385
347
|
# - id: Target ID
|
386
348
|
def delete_target(id)
|
387
|
-
|
388
|
-
|
389
|
-
|
390
349
|
if id.nil?
|
391
350
|
raise LinkemperorApiException.new('id should not be empty')
|
392
351
|
end
|
393
|
-
|
394
|
-
|
395
352
|
parameters = {}
|
396
353
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}")
|
397
|
-
|
398
354
|
end
|
399
|
-
|
355
|
+
|
356
|
+
# This method returns a list of all the Keywords that exist on your account. You can optionally limit the list to those keywords that belong to a specific campaign or target.
|
357
|
+
# Parameters:
|
358
|
+
# - target_id: Limit keywords to those belonging to this target.
|
359
|
+
# - campaign_id: Limit keywords to those belonging to this campaign.
|
360
|
+
def get_target_keywords(target_id = nil, campaign_id = nil)
|
361
|
+
exec_get("#{@base_path}/api/v2/customers/target_keywords.json?api_key=#{@api_key}")
|
362
|
+
end
|
363
|
+
|
364
|
+
# This method returns details about the Keyword you specify.
|
365
|
+
# Parameters:
|
366
|
+
# - id: Keyword ID
|
367
|
+
def get_target_keyword_by_id(id)
|
368
|
+
if id.nil?
|
369
|
+
raise LinkemperorApiException.new('id should not be empty')
|
370
|
+
end
|
371
|
+
exec_get("#{@base_path}/api/v2/customers/target_keywords/#{id}.json?api_key=#{@api_key}")
|
372
|
+
end
|
373
|
+
|
400
374
|
# This method creates a new Keyword. You will need to provide a Target ID.
|
401
375
|
# Parameters:
|
402
376
|
# - target_id: Target ID
|
403
377
|
# - keyword_string: Keyword string
|
404
378
|
def create_target_keyword(target_id, keyword_string)
|
405
|
-
|
406
|
-
|
407
|
-
|
408
379
|
if target_id.nil?
|
409
380
|
raise LinkemperorApiException.new('target_id should not be empty')
|
410
381
|
end
|
411
|
-
|
382
|
+
|
412
383
|
if keyword_string.nil?
|
413
384
|
raise LinkemperorApiException.new('keyword_string should not be empty')
|
414
385
|
end
|
415
|
-
|
416
|
-
|
417
386
|
parameters = {'target_keyword' => {'target_id' => target_id, 'keyword_string' => keyword_string}}
|
418
387
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/target_keywords.json?api_key=#{@api_key}")
|
419
|
-
|
420
388
|
end
|
421
|
-
|
389
|
+
|
422
390
|
# This method deletes the Keyword you specify.
|
423
391
|
# Parameters:
|
424
392
|
# - id: Keyword ID
|
425
393
|
def delete_target_keyword(id)
|
426
|
-
|
427
|
-
|
428
|
-
|
429
394
|
if id.nil?
|
430
395
|
raise LinkemperorApiException.new('id should not be empty')
|
431
396
|
end
|
432
|
-
|
433
|
-
|
434
397
|
parameters = {}
|
435
398
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/target_keywords/#{id}.json?api_key=#{@api_key}")
|
436
|
-
|
437
399
|
end
|
438
|
-
|
400
|
+
|
439
401
|
# This method returns a list of all the Trouble Spots that exist on your account.
|
440
402
|
#
|
441
403
|
# Trouble Spots are issues spotted by our On-Page SEO Checker for Campaigns.
|
442
404
|
# Parameters:
|
443
405
|
# none
|
444
406
|
def get_trouble_spots()
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
407
|
exec_get("#{@base_path}/api/v2/customers/trouble_spots.json?api_key=#{@api_key}")
|
450
|
-
|
451
408
|
end
|
452
|
-
|
409
|
+
|
453
410
|
# This method returns details about the Trouble Spot you specify.
|
454
411
|
# Parameters:
|
455
412
|
# - id: TroubleSpot ID
|
456
413
|
def get_trouble_spot_by_id(id)
|
457
|
-
|
458
|
-
|
459
|
-
|
460
414
|
if id.nil?
|
461
415
|
raise LinkemperorApiException.new('id should not be empty')
|
462
416
|
end
|
463
|
-
|
464
|
-
|
465
417
|
exec_get("#{@base_path}/api/v2/customers/trouble_spots/#{id}.json?api_key=#{@api_key}")
|
466
|
-
|
467
418
|
end
|
468
|
-
|
469
|
-
end
|
470
|
-
|
419
|
+
|
420
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'net/http'
|
3
2
|
require 'uri'
|
4
3
|
require 'json'
|
@@ -55,7 +54,7 @@ class LinkemperorVendor
|
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
|
-
|
57
|
+
|
59
58
|
# We call orders placed for your link building Service a Blast.
|
60
59
|
# Use this method to retrieve all outstanding orders for your link building service(s).
|
61
60
|
#
|
@@ -63,41 +62,36 @@ class LinkemperorVendor
|
|
63
62
|
# Parameters:
|
64
63
|
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
65
64
|
def get_blasts(service_id = nil)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
65
|
exec_get("#{@base_path}/api/v2/vendors/blasts.json?api_key=#{@api_key}")
|
71
|
-
|
72
66
|
end
|
73
|
-
|
67
|
+
|
74
68
|
# Pulls the next blast from the order queue, marks it as having been started,
|
75
69
|
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
76
70
|
# Parameters:
|
77
71
|
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
78
72
|
def get_next_blast(service_id = nil)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
73
|
exec_get("#{@base_path}/api/v2/vendors/blasts/next.json?api_key=#{@api_key}")
|
84
|
-
|
85
74
|
end
|
86
|
-
|
75
|
+
|
87
76
|
# Pulls a batch of blast from the order queue, marks them as having been started,
|
88
77
|
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
89
78
|
# Parameters:
|
90
79
|
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
91
80
|
# - batch_size: Batch size. If not provided, the default batch size is 100
|
92
81
|
def get_next_batch_blasts(service_id = nil, batch_size = nil)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
82
|
exec_get("#{@base_path}/api/v2/vendors/blasts/next_batch.json?api_key=#{@api_key}")
|
98
|
-
|
99
83
|
end
|
100
|
-
|
84
|
+
|
85
|
+
# Returns the full details of a Blast. Make sure to provide a Blast ID.
|
86
|
+
# Parameters:
|
87
|
+
# - id: ID # of the Blast
|
88
|
+
def get_blast_by_id(id)
|
89
|
+
if id.nil?
|
90
|
+
raise LinkemperorApiException.new('id should not be empty')
|
91
|
+
end
|
92
|
+
exec_get("#{@base_path}/api/v2/vendors/blasts/#{id}.json?api_key=#{@api_key}")
|
93
|
+
end
|
94
|
+
|
101
95
|
# 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
96
|
#
|
103
97
|
# After we receive this submission, we will verify the links provided within 24 hours.
|
@@ -107,87 +101,57 @@ class LinkemperorVendor
|
|
107
101
|
# - id: ID # of the Blast
|
108
102
|
# - links: A string containing the list of links to submit (newline delimited)
|
109
103
|
def submit_built_link(id, links)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
104
|
if id.nil?
|
114
105
|
raise LinkemperorApiException.new('id should not be empty')
|
115
106
|
end
|
116
|
-
|
107
|
+
|
117
108
|
if links.nil?
|
118
109
|
raise LinkemperorApiException.new('links should not be empty')
|
119
110
|
end
|
120
|
-
|
121
|
-
|
122
111
|
parameters = {'blast' => {'links' => links}}
|
123
112
|
exec_post(parameters, 'put', "#{@base_path}/api/v2/vendors/blasts/#{id}.json?api_key=#{@api_key}")
|
124
|
-
|
125
113
|
end
|
126
|
-
|
114
|
+
|
127
115
|
# Lists all available Services. This is a great way to automatically compare your service against the current competition.
|
128
116
|
# Parameters:
|
129
117
|
# none
|
130
118
|
def get_services()
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
119
|
exec_get("#{@base_path}/api/v2/vendors/services.json?api_key=#{@api_key}")
|
136
|
-
|
137
120
|
end
|
138
|
-
|
121
|
+
|
139
122
|
# Lists the full details of a specific Service.
|
140
123
|
# Parameters:
|
141
124
|
# - id: ID # of the Service
|
142
125
|
def get_service_by_id(id)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
126
|
if id.nil?
|
147
127
|
raise LinkemperorApiException.new('id should not be empty')
|
148
128
|
end
|
149
|
-
|
150
|
-
|
151
129
|
exec_get("#{@base_path}/api/v2/vendors/services/#{id}.json?api_key=#{@api_key}")
|
152
|
-
|
153
130
|
end
|
154
|
-
|
131
|
+
|
155
132
|
# 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
133
|
#
|
157
134
|
# This is a great way to clean your list of URLs used for submissions.
|
158
135
|
# Parameters:
|
159
136
|
# - id: ID # of the Service
|
160
137
|
def get_failed_domains(id)
|
161
|
-
|
162
|
-
|
163
|
-
|
164
138
|
if id.nil?
|
165
139
|
raise LinkemperorApiException.new('id should not be empty')
|
166
140
|
end
|
167
|
-
|
168
|
-
|
169
141
|
exec_get("#{@base_path}/api/v2/vendors/services/#{id}/failed_domains.json?api_key=#{@api_key}")
|
170
|
-
|
171
142
|
end
|
172
|
-
|
143
|
+
|
173
144
|
# 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
145
|
#
|
175
146
|
# This is particularly useful for testing new URL lists or potential link sources.
|
176
147
|
# Parameters:
|
177
148
|
# - id: ID # of the Service
|
178
149
|
def create_test_blast(id)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
150
|
if id.nil?
|
183
151
|
raise LinkemperorApiException.new('id should not be empty')
|
184
152
|
end
|
185
|
-
|
186
|
-
|
187
153
|
parameters = {}
|
188
154
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/vendors/services/#{id}/test_blast.json?api_key=#{@api_key}")
|
189
|
-
|
190
155
|
end
|
191
|
-
|
192
|
-
end
|
193
|
-
|
156
|
+
|
157
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkemperor-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Link Emperor API for Customers and Vendors
|
15
15
|
email:
|
@@ -28,8 +28,6 @@ files:
|
|
28
28
|
- lib/linkemperor-api/vendors.rb
|
29
29
|
- lib/linkemperor-api/version.rb
|
30
30
|
- linkemperor-api.gemspec
|
31
|
-
- php/customers.php
|
32
|
-
- php/vendors.php
|
33
31
|
homepage: http://www.linkemperor.com
|
34
32
|
licenses: []
|
35
33
|
post_install_message:
|
data/php/customers.php
DELETED
@@ -1,450 +0,0 @@
|
|
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
|
-
|
data/php/vendors.php
DELETED
@@ -1,173 +0,0 @@
|
|
1
|
-
|
2
|
-
<?php
|
3
|
-
class LinkemperorVendor {
|
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
|
-
# We call orders placed for your link building Service a Blast.
|
39
|
-
# Use this method to retrieve all outstanding orders for your link building service(s).
|
40
|
-
#
|
41
|
-
# 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.
|
42
|
-
# Parameters:
|
43
|
-
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
44
|
-
public function get_blasts($service_id = null) {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts.json");
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
# Pulls the next blast from the order queue, marks it as having been started,
|
54
|
-
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
55
|
-
# Parameters:
|
56
|
-
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
57
|
-
public function get_next_blast($service_id = null) {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts/next.json");
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
# Pulls a batch of blast from the order queue, marks them as having been started,
|
67
|
-
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
68
|
-
# Parameters:
|
69
|
-
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
70
|
-
# - batch_size: Batch size. If not provided, the default batch size is 100
|
71
|
-
public function get_next_batch_blasts($service_id = null, $batch_size = null) {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts/next_batch.json");
|
77
|
-
|
78
|
-
}
|
79
|
-
|
80
|
-
# Once you've completed link building for a request, you need to submit the URLs where links were built. This PUT method does that.
|
81
|
-
#
|
82
|
-
# After we receive this submission, we will verify the links provided within 24 hours.
|
83
|
-
# Once the links prove to be valid, we will credit your account immediately. If we cannot
|
84
|
-
# find enough valid backlinks in the links that you provided, we will suspend payment pending a manual review.
|
85
|
-
# Parameters:
|
86
|
-
# - id: ID # of the Blast
|
87
|
-
# - links: A string containing the list of links to submit (newline delimited)
|
88
|
-
public function submit_built_link($id, $links) {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
if(!$id) {
|
93
|
-
throw new Exception('id should not be empty');
|
94
|
-
}
|
95
|
-
|
96
|
-
if(!$links) {
|
97
|
-
throw new Exception('links should not be empty');
|
98
|
-
}
|
99
|
-
|
100
|
-
|
101
|
-
$parameters = array('blast' => array('links' => $links));
|
102
|
-
return $this->linkemperor_exec($parameters, 'PUT', "/api/v2/vendors/blasts/$id.json");
|
103
|
-
|
104
|
-
}
|
105
|
-
|
106
|
-
# Lists all available Services. This is a great way to automatically compare your service against the current competition.
|
107
|
-
# Parameters:
|
108
|
-
# none
|
109
|
-
public function get_services() {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services.json");
|
115
|
-
|
116
|
-
}
|
117
|
-
|
118
|
-
# Lists the full details of a specific Service.
|
119
|
-
# Parameters:
|
120
|
-
# - id: ID # of the Service
|
121
|
-
public function get_service_by_id($id) {
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
if(!$id) {
|
126
|
-
throw new Exception('id should not be empty');
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services/$id.json");
|
131
|
-
|
132
|
-
}
|
133
|
-
|
134
|
-
# 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.
|
135
|
-
#
|
136
|
-
# This is a great way to clean your list of URLs used for submissions.
|
137
|
-
# Parameters:
|
138
|
-
# - id: ID # of the Service
|
139
|
-
public function get_failed_domains($id) {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
if(!$id) {
|
144
|
-
throw new Exception('id should not be empty');
|
145
|
-
}
|
146
|
-
|
147
|
-
|
148
|
-
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services/$id/failed_domains.json");
|
149
|
-
|
150
|
-
}
|
151
|
-
|
152
|
-
# 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.
|
153
|
-
#
|
154
|
-
# This is particularly useful for testing new URL lists or potential link sources.
|
155
|
-
# Parameters:
|
156
|
-
# - id: ID # of the Service
|
157
|
-
public function create_test_blast($id) {
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
if(!$id) {
|
162
|
-
throw new Exception('id should not be empty');
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
$parameters = array();
|
167
|
-
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/vendors/services/$id/test_blast.json");
|
168
|
-
|
169
|
-
}
|
170
|
-
|
171
|
-
}
|
172
|
-
?>
|
173
|
-
|