API

Your api key: your_account_key_here_32_bytes_long
PHP example | PYTHON example


How to use API

How to send query to API

Send query (charset UTF-8) Via HTTP POST to address:

http://bulkaddurl.com/api

All POST parameters
apikey={apikey}
urls={urls}
name={name}
date_ot_print={date_ot_print}
date_do_print={date_do_print}
shuffle={shuffle}
check_already_added={check_already_added}
send_email_on_finish={send_email_on_finish}

Description:
  • {apikey} - Your APIKey, take your api key (32 bytes long) at http://bulkaddurl.com/user/api/ on the top of the page.
  • {urls} - Text with a list of urls you want to submit. You should use newline character to delimiter multiple urls.
Others parameters are optional.
  • {name} - (optional) Task name.
  • {date_ot_print} - (optional) Date of "When addurl starts (start)". Format: "year-month-day hours:minutes" (for example "2016-02-16 12:53"). If you send nothing, we will take current time.
  • {date_do_print} - (optional) Date of "When addurl starts (finish)". Format: "year-month-day hours:minutes" (for example "2016-02-16 12:53"). If you send nothing, we will take current time.
  • {shuffle} - (optional) Should we submit your urls in random order? Possible values: 0 - no shuffle, 1 - shuffle. Default value is 0.
  • {check_already_added} - (optional) Addurl only new urls that we have not already addurled? Possible values:
    1 - Yes. Check and add only urls that we have to added yet.
    0 - No. Add all urls. Special for ReIndexation (actualizate cache of page in Google).
    Default value is 1.
  • {send_email_on_finish} - (optional) Receive email after the task is finished? Possible values:
    1 - Yes. You'll receive email.
    0 - No. You will not receive email.
    Default value is 0.

API's answer

You'll get the answer in JSON format, 2 fields:

  • status
    Status success means that everything is ok, urls are added (in this case you'll find id of the task in the message field.
    Status error means that there was some error, you'll find the reason in the message field.
  • message Details of the operation.


PHP example

<?php

//your api key , take it at http://bulkaddurl.com/user/api/
$apikey = 'your_account_key_here_32_bytes_long';

//your urls that you want to submit to google
$urls = array(
	'http://google1.com',
	'https://ru.wikipedia.org/wiki/%D0%9A%D1%80%D0%B0%D1%81%D0%BE%D1%82%D0%B0',
	'http://google.ru/спасибо мир',
	'http://гугл.рф',
);

header('Content-Type: text/html; charset=utf-8');
$r = send_to_bulkaddurl($apikey, $urls);
print 'Result:<pre>';
print_r( $r );

###########################################################main function
function send_to_bulkaddurl($apikey, $urls) {
	$url_api = 'http://bulkaddurl.com/api';

	$urls = implode(PHP_EOL, $urls);

	$fields = array(
			'urls'=>$urls,
			'apikey'=>$apikey,

			'name'=>'Adding task with api',
		);

	$fields_string = http_build_query($fields);

	//open connection
	$ch = curl_init();

	//set the url, number of POST vars, POST data
	curl_setopt($ch,CURLOPT_URL,$url_api);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	//execute post
	$result = curl_exec($ch);
	//print $result;
	//die();

	$result = json_decode($result, true);
	return $result;
}
?>

PYTHON 2.7 example

#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests

apikey = 'your_account_key_here_32_bytes_long'

url_api = 'http://bulkaddurl.com/api'


urls = [
	'http://google1.com',
	'https://ru.wikipedia.org/wiki/%D0%9A%D1%80%D0%B0%D1%81%D0%BE%D1%82%D0%B0',
	'http://google.ru/спасибо мир',
	'http://гугл.рф',
]

urls_txt = '\n'.join(urls)

data = {
	'name':'Adding task with api through python',
	'urls':urls_txt,
	'apikey':apikey,

	'check_already_added':0,
}

resp = requests.post(url_api, data=data)

code = resp.status_code
answer = resp.text

print 'code:', code
print 'answer:', answer

#code: 200
#answer: {"status":"success","message":"task_id:1234567"}


3=0/0.16