This API is used for new Auth Management Tool. With this method you can Add Credentials. To use this method you need to retrive Proxy ID for you want to Create New Credentials.
Merchant Tools:
For Merchant Tools Proxy ID can be retrived by get_server_proxies API method, you also need to specify service => merchant if Proxy ID is retrived from your Merchant Tools.
Cloud Tools:
You can retrive proxies that can be used for auth management from your proxy list, this can be done by get_proxy_list
Important: For Cloud you may only use proxies that are created with service that do support auth management, so make sure that [auth_management] => 1 for Proxy that you want to Add Credentials.
Name | Requirements | Options | |
---|---|---|---|
api_key | string|required | Get your api key from https://createproxy.com/dashboard/api | |
category_id | numeric|required | This is optional, you can define category_id, so only credentials in this category will be returned. | |
customer_auth | numeric|required | Set customer_auth => 1 for proxies that will be secured by IP Address, you will also need to pass whitelist, to secure Proxy by USERNAME:PASSWORD set customer_auth => 2 | |
type | numeric|required | Set if this credential is for Cloud Tools Proxies or Merchant Tools Proxies, 1 = merchant; 2 = cloud | |
proxy_id | numeric|required | This is Proxy ID for which you want to create credentials for, to retrive available merchant proxies run: https://createproxy.com/api/merchant/get_server_proxies/ and to retrive cloud proxies run: https://createproxy.com/api/cloud/get_proxy_list/ - for cloud make sure [auth_management] => 1 | |
proxy_username | string | If customer_auth is 2 you must fill Proxy username, it can be string min 3 characters numbers and characters only. | |
proxy_password | string | If customer_auth is 2 you must fill Proxy password, it can be string min 3 characters numbers and characters only. | |
whitelist | string | If customer_auth is 1 you must fill whitelist, so only inserted IP Addreses may use this credentials. (no USERNAME:PASSWORD so proxy_username and proxy_password should be null). | |
expiration | numeric | Number of hours from now when Proxy will expire / became unavailable, this is optional or you may set 0 to disable automatic expiration. |
// Read more at https://www.createproxy.com/api/auth/add_credentials/
// createproxy.class.php is available on GitHub: https://github.com/Coxii/CreateProxy
require_once "createproxy.class.php";
$client = new CreateProxyClient('REPLACE_WITH_YOUR_API_KEY');
$params = array();
$params['category_id'] = "0"; // This is optional, you can define category_id, so only credentials in this category will be returned.
$params['customer_auth'] = "2"; // Set customer_auth => 1 for proxies that will be secured by IP Address, you will also need to pass whitelist, to secure Proxy by USERNAME:PASSWORD set customer_auth => 2
$params['type'] = "1"; // Set if this credential is for Cloud Tools Proxies or Merchant Tools Proxies, 1 = merchant; 2 = cloud
$params['proxy_id'] = "458559"; // This is Proxy ID for which you want to create credentials for, to retrive available merchant proxies run: https://createproxy.com/api/merchant/get_server_proxies/ and to retrive cloud proxies run: https://createproxy.com/api/cloud/get_proxy_list/ - for cloud make sure [auth_management] => 1
$params['proxy_username'] = "MyLoginName"; // If customer_auth is 2 you must fill Proxy username, it can be string min 3 characters numbers and characters only.
$params['proxy_password'] = "123456"; // If customer_auth is 2 you must fill Proxy password, it can be string min 3 characters numbers and characters only.
$params['whitelist'] = "172.16.254.1,192.168.1.15,2001:db8:0:1234:0:567:8:1"; // If customer_auth is 1 you must fill whitelist, so only inserted IP Addreses may use this credentials. (no USERNAME:PASSWORD so proxy_username and proxy_password should be null).
$params['expiration'] = "0"; // Number of hours from now when Proxy will expire / became unavailable, this is optional or you may set 0 to disable automatic expiration.
try {
$request = $client->request('auth','add_credentials',$params);
} catch(CreateProxyException $e) {
print_r($e->getMessage());
exit;
}
echo '<pre>';
print_r($request);
echo '</pre>';
// CreateProxy API end
<!-- Read more at https://www.createproxy.com/api/auth/add_credentials/ -->
$api_url = "https://www.createproxy.com/api/request/auth/add_credentials/";
$params = array();
$params['api_key'] = "REPLACE_WITH_YOUR_API_KEY"; // Get your api key from https://createproxy.com/dashboard/api
$params['category_id'] = "0"; // This is optional, you can define category_id, so only credentials in this category will be returned.
$params['customer_auth'] = "2"; // Set customer_auth => 1 for proxies that will be secured by IP Address, you will also need to pass whitelist, to secure Proxy by USERNAME:PASSWORD set customer_auth => 2
$params['type'] = "1"; // Set if this credential is for Cloud Tools Proxies or Merchant Tools Proxies, 1 = merchant; 2 = cloud
$params['proxy_id'] = "458559"; // This is Proxy ID for which you want to create credentials for, to retrive available merchant proxies run: https://createproxy.com/api/merchant/get_server_proxies/ and to retrive cloud proxies run: https://createproxy.com/api/cloud/get_proxy_list/ - for cloud make sure [auth_management] => 1
$params['proxy_username'] = "MyLoginName"; // If customer_auth is 2 you must fill Proxy username, it can be string min 3 characters numbers and characters only.
$params['proxy_password'] = "123456"; // If customer_auth is 2 you must fill Proxy password, it can be string min 3 characters numbers and characters only.
$params['whitelist'] = "172.16.254.1,192.168.1.15,2001:db8:0:1234:0:567:8:1"; // If customer_auth is 1 you must fill whitelist, so only inserted IP Addreses may use this credentials. (no USERNAME:PASSWORD so proxy_username and proxy_password should be null).
$params['expiration'] = "0"; // Number of hours from now when Proxy will expire / became unavailable, this is optional or you may set 0 to disable automatic expiration.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$api_url");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_ENCODING,"gzip,deflate");
$result=curl_exec($ch);
curl_close($ch);
if($result === false) {
die("Failed to perform request");
}
$response = json_decode($result, true);
if(!$response) {
die('CreateProxy responded with invalid response');
} else if(!isset($response['type'])) {
die('CreateProxy responded with incorrect status key');
} else if($response['type'] == 'error') {
if(isset($response['title']) AND isset($response['message'])) {
die($response['title']. ': ' . $response['message']);
} else if(isset($response['message'])){
die('API ERROR: ' . $response['message']);
} else {
die('API UNDEFINNED ERROR');
}
}
echo '<pre>';
print_r($response);
echo '</pre>';
<!-- CreateProxy API end -->
// read more at https://www.createproxy.com/api/auth/add_credentials/
using System;
using System.Diagnostics;
using System.Net;
using System.IO;
class Program
{
static void Main(string[] args)
{
string api_key = "REPLACE_WITH_YOUR_API_KEY";
string category_id = "0";
string customer_auth = "2";
string type = "1";
string proxy_id = "458559";
string proxy_username = "MyLoginName";
string proxy_password = "123456";
string whitelist = "172.16.254.1,192.168.1.15,2001:db8:0:1234:0:567:8:1";
string expiration = "0";
string serviceUri = "https://www.createproxy.com/api/request/auth/add_credentials/";
string post_data = "api_key=" + api_key + "category_id=" + category_id + "customer_auth=" + customer_auth + "type=" + type + "proxy_id=" + proxy_id + "proxy_username=" + proxy_username + "proxy_password=" + proxy_password + "whitelist=" + whitelist + "expiration=" + expiration;
// create a request
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(serviceUri);
request.Method = "POST";
// turn our request string into a byte stream
byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(post_data);
// this is important - make sure you specify type this way
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
// now send it
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
// grab te response and print it out to the console
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadToEnd());
Console.ReadLine();
}
}
curl -X POST -F 'api_key=REPLACE_WITH_YOUR_API_KEY' -F 'category_id=0' -F 'customer_auth=2' -F 'type=1' -F 'proxy_id=458559' -F 'proxy_username=MyLoginName' -F 'proxy_password=123456' -F 'whitelist=172.16.254.1,192.168.1.15,2001:db8:0:1234:0:567:8:1' -F 'expiration=0' https://www.createproxy.com/api/request/auth/add_credentials/
import requests
files = {
'api_key': (None, 'REPLACE_WITH_YOUR_API_KEY'),
'category_id': (None, '0'),
'customer_auth': (None, '2'),
'type': (None, '1'),
'proxy_id': (None, '458559'),
'proxy_username': (None, 'MyLoginName'),
'proxy_password': (None, '123456'),
'whitelist': (None, '172.16.254.1,192.168.1.15,2001:db8:0:1234:0:567:8:1'),
'expiration': (None, '0'),
}
response = requests.post('https://www.createproxy.com/api/request/auth/add_credentials/', files=files)