How can I use Unlocker for Asynchronous requests?

Gal El Al
Gal El Al
  • Updated
Send requests without waiting for a response. Collect results via a designated endpoint or a webhook.

To initiate a request, perform:

 

Request via proxy interface:

RESPONSE_ID=`curl -i --silent --proxy zproxy.lum-superproxy.io:22225 --proxy-user lum-customer-<YOUR_CUSTOMER_ID>-zone-<YOUR_ZONE>:<PASS> -k "<Target site>" | sed -En 's/^x-response-id: (.*)/\1/p' | tr -d '\r'`

 

Request via API interface:

 

RESPONSE_ID=`curl -i --silent --compressed "https://brightdata.com/api/unblocker/req?customer=<Accound ID>&zone=<ZONE>" -H "Content-Type: application/json" -H "Authorization: Bearer <API token>" -d "{\"country\":\"us\",\"url\":\"<Target site>\"}" | sed -En 's/^x-response-id: (.*)/\1/p' | tr -d '\r'`

 

Get response (same for both proxy and API interface):

curl -v --compressed "https://brightdata.com/api/unblocker/get_result?customer=<YOUR_CUSTOMER_ID>&zone=<YOUR_ZONE>&response_id=${RESPONSE_ID}" -H "Authorization: Bearer <API token>"

 

You can adjust your zone async settings on the zones page.
Optional settings:
Result lifetime (days) - number of days to keep results
Web Hook URL - address to deliver results
Web Hook Request Method - HTTP method to use to deliver response, GET or POST are optional