This article explains on how to apply a specific configuration version of Cloud Proxy Manager with an API command.
API endpoint:
PUT /lpm/apply_conf/
Query parameters:
lpm_token - {TOKEN|CUSTOMER_NAME}
, requiredBody parameters:
id - conf state id from GET /lpm/apply_conf
Sample Response:
Code: 200
Message: ok
Shell
curl -PUT "https://brightdata.com/lpm/apply_conf?lpm_token=<PROXY_MANAGER_TOKEN>" -H "Content-Type: application/json" -d '{"id": "6453ae71866cf2e93fd154fa"}'
Node.js
#!/usr/bin/env node
require('request-promise')({
method: 'PUT',
url: 'https://brightdata.com/lpm/apply_conf?lpm_token=<PROXY_MANAGER_TOKEN>',
json: {"id": "6453ae71866cf2e93fd154fa"},
headers: {'Content-Type': 'application/json'},
}).then(function(data){ console.log(data); },
function(err){ console.error(err); });
Java
package example; import org.apache.http.HttpHost; import org.apache.http.client.fluent.*; public class Example { public static void main(String[] args) throws Exception {
String body = "{\"id\":\"6453ae71866cf2e93fd154fa\"}"; String res = Executor.newInstance()
.execute(Request.Put("https://brightdata.com/lpm/apply_conf?lpm_token=<PROXY_MANAGER_TOKEN>")
.bodyString(body, ContentType.APPLICATION_JSON))
.returnContent().asString();
System.out.println(res) }
}
C#
using System; using System.Net; using System.Net.Http; using System.Net.Http.Headers; public class Program { public static async Task Main() { var client = new HttpClient(); var requestMessage = new HttpRequestMessage { Method = HttpMethod.Put,
RequestUri = new Uri("https://brightdata.com/lpm/apply_conf?lpm_token=<PROXY_MANAGER_TOKEN>"),
Content = new StringContent(JsonConvert.SerializeObject(new {
id = "6453ae71866cf2e93fd154fa"
}), Encoding.UTF8, "application/json")) }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } }
Python
#!/usr/bin/env python
print('If you get error "ImportError: No module named requests", please install it:\n$ sudo pip install requests');
import requests
import json
data = {'id':'6453ae71866cf2e93fd154fa'}
headers = {'Content-Type': 'application/json'}
r = requests.put('https://brightdata.com/lpm/apply_conf?lpm_token=<PROXY_MANAGER_TOKEN>', data=json.dumps(data), headers=headers)
print(r.content)