BrowserAct Logo
template bg

Google Maps Search API


You can access the Google Maps Search API programmatically from your own applications using the BrowserAct API.


To get started, you’ll need a BrowserAct account and your API key, which you can find in the API & Integrations section of the BrowserAct dashboard. Once authenticated, you can call the API from your application and receive structured business data in JSON or CSV format, ready for automation and downstream processing.


The BrowserAct API Client is the official SDK for accessing the Google Maps Search API .


It provides official clients for Python, Java, and Node.js, enabling developers to integrate BrowserAct into their applications using their preferred language.

All clients offer convenience methods, built-in error handling, and automatic retries, ensuring stable, production-ready integrations.

View more about the BrowserAct API


📍 Python

You only need to replace the API_KEY in the code with your BrowserAct API key, adjust the parameter values based on your needs, and the code will run successfully.

"""
Scenario 2: Run Template Task and Wait for Completion ⭐ Recommended for Beginners

Business Need:
Start a workflow task using an official template, wait for it to complete, and then get the results.

Use Cases:
- Need to synchronously wait for task completion
- Need to get the complete output results of the task
- Suitable for single task execution
- Perfect for users who want to use official templates without creating custom workflows

Usage Steps:
1. Modify API_KEY and WORKFLOW_TEMPLATE_ID below
2. Modify input_parameters according to the template requirements
3. Run script: python Scenarios-Python/scenario_2_run_template_and_wait.py
"""

import os
import time
import traceback
import json
import requests

# ============ Configuration Area - Please modify the following variables ============
# API Key, get from: https://www.browseract.com/reception/integrations
API_KEY = os.getenv("BROWSERACT_API_KEY", "app-abcdefghijklmn")

# Workflow Template ID, you can get it from:
# - Run: python Workflow-Python/11.list_official_workflow_templates.py
# - Or visit: https://www.browseract.com/template?platformType=0
WORKFLOW_TEMPLATE_ID = "77805072070738748"

# Workflow input parameters (modify according to the template definition)
INPUT_PARAMETERS = [
{
"name": "KeyWords",
"value": "coffee"
},
{
"name": "language",
"value": "en"
},
{
"name": "country",
"value": "us"
},
{
"name": "max_dates",
"value": "100"
}
]

# Polling configuration
POLL_INTERVAL = 5 # Check task status every 5 seconds
MAX_WAIT_TIME = 1800 # Maximum wait time: 30 minutes (1800 seconds)
# ================================================

API_BASE_URL = "https://api.browseract.com/v2/workflow"

def run_task_by_template(workflow_template_id, input_parameters):
"""Start a task using template"""
headers = {
"Authorization": f"Bearer {API_KEY}"
}

data = {
"workflow_template_id": workflow_template_id,
"input_parameters": input_parameters,
}

api_url = f"{API_BASE_URL}/run-task-by-template"
response = requests.post(api_url, json=data, headers=headers)

if response.status_code == 200:
result = response.json()
task_id = result["id"]
print(f"✅ Task started, Task ID: {task_id}")
if "profileId" in result:
print(f" Profile ID: {result['profileId']}")
return task_id
else:
print(f"❌ Failed to start task: {response.json()}")
return None

def get_task_status(task_id):
"""Get task status"""
headers = {
"Authorization": f"Bearer {API_KEY}"
}

api_url = f"{API_BASE_URL}/get-task-status?task_id={task_id}"
try:
response = requests.get(api_url, headers=headers, timeout=30)

if response.status_code == 200:
return response.json().get("status")
else:
print(f"⚠️ Failed to get task status: {response.json()}")
return None
except (requests.exceptions.SSLError, requests.exceptions.ConnectionError,
requests.exceptions.Timeout, requests.exceptions.RequestException) as e:
# Network error, will retry in next polling cycle
return None

def get_task(task_id):
"""Get detailed task information"""
headers = {
"Authorization": f"Bearer {API_KEY}"
}

api_url = f"{API_BASE_URL}/get-task?task_id={task_id}"
try:
response = requests.get(api_url, headers=headers, timeout=30)

if response.status_code == 200:
return response.json()
else:
print(f"⚠️ Failed to get task details: {response.json()}")
return None
except (requests.exceptions.SSLError, requests.exceptions.ConnectionError,
requests.exceptions.Timeout, requests.exceptions.RequestException) as e:
print(f"⚠️ Network error while getting task details: {type(e).__name__}")
return None

def wait_for_task_completion(task_id):
"""Wait for task completion"""
start_time = time.time()
previous_status = None

print(f"\n⏳ Waiting for task completion (max wait time: {MAX_WAIT_TIME // 60} minutes)...")

while True:
# Check if timeout
elapsed_time = time.time() - start_time
if elapsed_time > MAX_WAIT_TIME:
print(f"\n⏰ Wait timeout (waited {elapsed_time:.0f} seconds)")
return None

# Get task status
status = get_task_status(task_id)

if status is None:
# Network error or API error, continue waiting
elapsed = int(elapsed_time)
print()
print(f" Network error, retrying... (waited {elapsed} seconds)", end="\r")
elif status == "finished":
print(f"\n✅ Task completed!")
return "finished"
elif status == "failed":
print(f"\n❌ Task execution failed")
return "failed"
elif status == "canceled":
print(f"\n🚫 Task canceled")
return "canceled"
else:
# running, created, paused, etc.
elapsed = int(elapsed_time)
# If status changed, print on new line; otherwise update same line
if status != previous_status:
print() # New line when status changes
print(f" Status: {status} (waited {elapsed} seconds)", end="\r")
previous_status = status
else:
# Same status, update same line
print(f" Status: {status} (waited {elapsed} seconds)", end="\r")

# Wait before checking again
time.sleep(POLL_INTERVAL)

def main():
print("=" * 60)
print("Scenario 2: Run Template Task and Wait for Completion")
print("=" * 60)

try:
# Step 1: Start task using template
print("\n📤 Step 1: Starting task using template...")
print(f" Template ID: {WORKFLOW_TEMPLATE_ID}")
task_id = run_task_by_template(WORKFLOW_TEMPLATE_ID, INPUT_PARAMETERS)

if task_id is None:
print("❌ Unable to start task, exiting")
return

# Step 2: Wait for task completion
print("\n📥 Step 2: Waiting for task completion...")
final_status = wait_for_task_completion(task_id)

# Step 3: Get task results
print("\n📊 Step 3: Getting task results...")
task_info = get_task(task_id)

if task_info:
print("\n" + "=" * 60)
print("Task Result (JSON):")
print("=" * 60)
# Output complete task result as formatted JSON
print(json.dumps(task_info, indent=2, ensure_ascii=False))
print("=" * 60)
else:
print("⚠️ Unable to get task details")

except Exception as e:
error = traceback.format_exc()
print(f"\n❌ Error occurred:\n{error}")

if __name__ == "__main__":
main()


📍 Node.js

You only need to replace the API_KEY in the code with your BrowserAct API key, adjust the parameter values based on your needs, and the code will run successfully.

/**
* Scenario 2: Run Template Task and Wait for Completion ⭐ Recommended for Beginners
*
* Business Need:
* Start a workflow task using an official template, wait for it to complete, and then get the results.
*
* Use Cases:
* - Need to synchronously wait for task completion
* - Need to get the complete output results of the task
* - Suitable for single task execution
* - Perfect for users who want to use official templates without creating custom workflows
*
* Usage Steps:
* 1. Modify API_KEY and WORKFLOW_TEMPLATE_ID below
* 2. Modify input_parameters according to the template requirements
* 3. Run: node scenario2_runTemplateAndWait.js
*/

const https = require('https');

// ============ Configuration Area - Please modify the following variables ============
// API Key, get from: https://www.browseract.com/reception/integrations
const API_KEY = process.env.BROWSERACT_API_KEY || "app-abcdefghijklmn";

// Workflow Template ID, you can get it from:
// - Run: node ../Workflow-NodeJs/11.listOfficialWorkflowTemplates.js
// - Or visit: https://www.browseract.com/template?platformType=0
const WORKFLOW_TEMPLATE_ID = "77805072070738748";

// Polling configuration
const POLL_INTERVAL = 5; // Check task status every 5 seconds
const MAX_WAIT_TIME = 1800; // Maximum wait time: 30 minutes (1800 seconds)
// ================================================

const API_BASE_URL = "https://api.browseract.com/v2/workflow";

function makeRequest(options, data) {
return new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
let responseData = '';

res.on('data', (chunk) => {
responseData += chunk;
});

res.on('end', () => {
if (res.statusCode === 200) {
resolve(JSON.parse(responseData));
} else {
reject(new Error(`HTTP ${res.statusCode}: ${responseData}`));
}
});
});

req.on('error', (error) => {
reject(error);
});

req.setTimeout(30000, () => {
req.destroy();
reject(new Error('Request timeout'));
});

if (data) {
req.write(data);
}
req.end();
});
}

function runTaskByTemplate(workflowTemplateId, inputParameters) {
return new Promise((resolve, reject) => {
const data = JSON.stringify({
workflow_template_id: workflowTemplateId,
input_parameters: inputParameters
});

const options = {
hostname: 'api.browseract.com',
port: 443,
path: '/v2/workflow/run-task-by-template',
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data)
}
};

makeRequest(options, data)
.then(result => {
const taskId = result.id;
console.log(`✅ Task started, Task ID: ${taskId}`);
if (result.profileId) {
console.log(` Profile ID: ${result.profileId}`);
}
resolve(taskId);
})
.catch(error => {
console.log(`❌ Failed to start task: ${error.message}`);
resolve(null);
});
});
}

function getTaskStatus(taskId) {
return new Promise((resolve) => {
const options = {
hostname: 'api.browseract.com',
port: 443,
path: `/v2/workflow/get-task-status?task_id=${taskId}`,
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`
}
};

makeRequest(options)
.then(result => {
resolve(result.status);
})
.catch(() => {
// Network error, will retry in next polling cycle
resolve(null);
});
});
}

function getTask(taskId) {
return new Promise((resolve) => {
const options = {
hostname: 'api.browseract.com',
port: 443,
path: `/v2/workflow/get-task?task_id=${taskId}`,
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`
}
};

makeRequest(options)
.then(result => {
resolve(result);
})
.catch(error => {
console.log(`⚠️ Network error while getting task details: ${error.message}`);
resolve(null);
});
});
}

async function waitForTaskCompletion(taskId) {
const startTime = Date.now();
let previousStatus = null;

console.log(`\n⏳ Waiting for task completion (max wait time: ${MAX_WAIT_TIME / 60} minutes)...`);

while (true) {
// Check if timeout
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
if (elapsedTime > MAX_WAIT_TIME) {
console.log(`\n⏰ Wait timeout (waited ${elapsedTime} seconds)`);
return null;
}

// Get task status
const status = await getTaskStatus(taskId);

if (status === null) {
// Network error or API error, continue waiting
console.log();
process.stdout.write(` Network error, retrying... (waited ${elapsedTime} seconds)\r`);
} else if (status === "finished") {
console.log(`\n✅ Task completed!`);
return "finished";
} else if (status === "failed") {
console.log(`\n❌ Task execution failed`);
return "failed";
} else if (status === "canceled") {
console.log(`\n🚫 Task canceled`);
return "canceled";
} else {
// running, created, paused, etc.
// If status changed, print on new line; otherwise update same line
if (status !== previousStatus) {
console.log(); // New line when status changes
process.stdout.write(` Status: ${status} (waited ${elapsedTime} seconds)\r`);
previousStatus = status;
} else {
// Same status, update same line
process.stdout.write(` Status: ${status} (waited ${elapsedTime} seconds)\r`);
}
}

// Wait before checking again
await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL * 1000));
}
}

async function main() {
console.log("============================================================");
console.log("Scenario 2: Run Template Task and Wait for Completion");
console.log("============================================================");

try {
// Step 1: Start task using template
console.log("\n📤 Step 1: Starting task using template...");
console.log(` Template ID: ${WORKFLOW_TEMPLATE_ID}`);

// Workflow input parameters (modify according to the template definition)
const inputParameters = [
{
name: "KeyWords",
value: "coffee"
},
{
name: "language",
value: "en"
},
{
name: "country",
value: "us"
},
{
name: "max_dates",
value: "100"
}
];

const taskId = await runTaskByTemplate(WORKFLOW_TEMPLATE_ID, inputParameters);

if (!taskId) {
console.log("❌ Unable to start task, exiting");
return;
}

// Step 2: Wait for task completion
console.log("\n📥 Step 2: Waiting for task completion...");
const finalStatus = await waitForTaskCompletion(taskId);

// Step 3: Get task results
console.log("\n📊 Step 3: Getting task results...");
const taskInfo = await getTask(taskId);

if (taskInfo) {
console.log("\n============================================================");
console.log("Task Result (JSON):");
console.log("============================================================");
// Output complete task result as formatted JSON
console.log(JSON.stringify(taskInfo, null, 2));
console.log("============================================================");
} else {
console.log("⚠️ Unable to get task details");
}

} catch (error) {
console.error("\n❌ Error occurred:");
console.error(error);
}
}

main();


📍 Java

You only need to replace the API_KEY in the code with your BrowserAct API key, adjust the parameter values based on your needs, and the code will run successfully.


package com.browseract.scenarios;

/**
* Scenario 2: Run Template Task and Wait for Completion ⭐ Recommended for Beginners
*
* Business Need:
* Start a workflow task using an official template, wait for it to complete, and then get the results.
*
* Use Cases:
* - Need to synchronously wait for task completion
* - Need to get the complete output results of the task
* - Suitable for single task execution
* - Perfect for users who want to use official templates without creating custom workflows
*
* Usage Steps:
* 1. Add Jackson dependency to your project (Maven/Gradle):
* Maven (pom.xml):
* <dependency>
* <groupId>com.fasterxml.jackson.core</groupId>
* <artifactId>jackson-databind</artifactId>
* <version>2.15.2</version>
* </dependency>
*
* 2. Modify API_KEY and WORKFLOW_TEMPLATE_ID below
* 3. Modify input_parameters according to the template requirements
* 4. Run: mvn exec:java -Dexec.mainClass="com.browseract.scenarios.Scenario2RunTemplateAndWait"
*
* Note: This file is self-contained and can be copied directly into your IDE.
* All HTTP utility methods are included at the bottom of this file.
*/

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.*;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Scenario2RunTemplateAndWait {

// ============ Configuration Area - Please modify the following variables ============
// API Key, get from: https://www.browseract.com/reception/integrations
private static final String API_KEY = System.getenv("BROWSERACT_API_KEY") != null
? System.getenv("BROWSERACT_API_KEY")
: "app-abcdefghijklmn";

// Workflow Template ID, you can get it from:
// - Run: java -cp target/classes com.browseract.workflow.demo.ListOfficialWorkflowTemplates
// - Or visit: https://www.browseract.com/template?platformType=0
private static final String WORKFLOW_TEMPLATE_ID = "77805072070738748";

// Polling configuration
private static final int POLL_INTERVAL = 5; // Check task status every 5 seconds
private static final int MAX_WAIT_TIME = 1800; // Maximum wait time: 30 minutes (1800 seconds)
// ================================================

private static final String API_BASE_URL = "https://api.browseract.com/v2/workflow";
private static final ObjectMapper objectMapper = new ObjectMapper();

public static void main(String[] args) {
System.out.println("============================================================");
System.out.println("Scenario 2: Run Template Task and Wait for Completion");
System.out.println("============================================================");

try {
// Step 1: Start task using template
System.out.println("\n📤 Step 1: Starting task using template...");
System.out.println(" Template ID: " + WORKFLOW_TEMPLATE_ID);

// Workflow input parameters (modify according to the template definition)
List<InputParameter> inputParameters = new ArrayList<>();
inputParameters.add(new InputParameter("KeyWords", "coffee"));
inputParameters.add(new InputParameter("language", "en"));
inputParameters.add(new InputParameter("country", "us"));
inputParameters.add(new InputParameter("max_dates", "100"));

String taskId = runTaskByTemplate(WORKFLOW_TEMPLATE_ID, inputParameters);

if (taskId == null) {
System.out.println("❌ Unable to start task, exiting");
return;
}

// Step 2: Wait for task completion
System.out.println("\n📥 Step 2: Waiting for task completion...");
String finalStatus = waitForTaskCompletion(taskId);

// Step 3: Get task results
System.out.println("\n📊 Step 3: Getting task results...");
String taskInfoJson = getTask(taskId);

if (taskInfoJson != null) {
System.out.println("\n============================================================");
System.out.println("Task Result (JSON):");
System.out.println("============================================================");
// Output complete task result as formatted JSON
JsonNode jsonNode = objectMapper.readTree(taskInfoJson);
System.out.println(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode));
System.out.println("============================================================");
} else {
System.out.println("⚠️ Unable to get task details");
}

} catch (Exception e) {
System.err.println("\n❌ Error occurred:");
e.printStackTrace();
}
}

private static String runTaskByTemplate(String workflowTemplateId, List<InputParameter> inputParameters) {
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Bearer " + API_KEY);

RunTaskByTemplateRequest requestBody = new RunTaskByTemplateRequest();
requestBody.setWorkflow_template_id(workflowTemplateId);
requestBody.setInput_parameters(inputParameters);

String apiUrl = API_BASE_URL + "/run-task-by-template";
HttpResult result = postJson(apiUrl, requestBody, headers);

if (result.isSuccess()) {
try {
JsonNode jsonNode = objectMapper.readTree(result.getText());
String taskId = jsonNode.get("id").asText();
System.out.println("✅ Task started, Task ID: " + taskId);
if (jsonNode.has("profileId")) {
System.out.println(" Profile ID: " + jsonNode.get("profileId").asText());
}
return taskId;
} catch (Exception e) {
System.out.println("❌ Failed to parse response: " + e.getMessage());
return null;
}
} else {
System.out.println("❌ Failed to start task: " + result.getText());
return null;
}
}

private static String getTaskStatus(String taskId) {
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Bearer " + API_KEY);

String apiUrl = API_BASE_URL + "/get-task-status?task_id=" + taskId;
HttpResult result = get(apiUrl, headers);

if (result.isSuccess()) {
try {
JsonNode jsonNode = objectMapper.readTree(result.getText());
return jsonNode.get("status").asText();
} catch (Exception e) {
return null;
}
} else {
// Network error or API error, will retry in next polling cycle
return null;
}
}

private static String getTask(String taskId) {
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Bearer " + API_KEY);

String apiUrl = API_BASE_URL + "/get-task?task_id=" + taskId;
HttpResult result = get(apiUrl, headers);

if (result.isSuccess()) {
return result.getText();
} else {
System.out.println("⚠️ Network error while getting task details: " + result.getText());
return null;
}
}

private static String waitForTaskCompletion(String taskId) {
long startTime = System.currentTimeMillis();
String previousStatus = null;

System.out.println("\n⏳ Waiting for task completion (max wait time: " + (MAX_WAIT_TIME / 60) + " minutes)...");

while (true) {
// Check if timeout
long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
if (elapsedTime > MAX_WAIT_TIME) {
System.out.println("\n⏰ Wait timeout (waited " + elapsedTime + " seconds)");
return null;
}

// Get task status
String status = getTaskStatus(taskId);

if (status == null) {
// Network error or API error, continue waiting
System.out.println();
System.out.print(" Network error, retrying... (waited " + elapsedTime + " seconds)\r");
} else if ("finished".equals(status)) {
System.out.println("\n✅ Task completed!");
return "finished";
} else if ("failed".equals(status)) {
System.out.println("\n❌ Task execution failed");
return "failed";
} else if ("canceled".equals(status)) {
System.out.println("\n🚫 Task canceled");
return "canceled";
} else {
// running, created, paused, etc.
// If status changed, print on new line; otherwise update same line
if (!status.equals(previousStatus)) {
System.out.println(); // New line when status changes
System.out.print(" Status: " + status + " (waited " + elapsedTime + " seconds)\r");
previousStatus = status;
} else {
// Same status, update same line
System.out.print(" Status: " + status + " (waited " + elapsedTime + " seconds)\r");
}
}

// Wait before checking again
try {
Thread.sleep(POLL_INTERVAL * 1000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
}

// Inner classes for request/response
public static class RunTaskByTemplateRequest {
private String workflow_template_id;
private List<InputParameter> input_parameters;

public String getWorkflow_template_id() { return workflow_template_id; }
public void setWorkflow_template_id(String workflow_template_id) { this.workflow_template_id = workflow_template_id; }

public List<InputParameter> getInput_parameters() { return input_parameters; }
public void setInput_parameters(List<InputParameter> input_parameters) { this.input_parameters = input_parameters; }
}

public static class InputParameter {
private String name;
private String value;

public InputParameter(String name, String value) {
this.name = name;
this.value = value;
}

public String getName() { return name; }
public void setName(String name) { this.name = name; }

public String getValue() { return value; }
public void setValue(String value) { this.value = value; }
}

// ========================================================================
// HTTP Utility Methods (Inline implementation for easy copy-paste)
// ========================================================================

/**
* Send POST request with JSON body
*/
private static HttpResult postJson(String url, Object requestBody, Map<String, String> headers) {
try {
URL urlObj = URI.create(url).toURL();
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();

// Set request method and headers
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);
connection.setConnectTimeout(30000);
connection.setReadTimeout(30000);

// Add custom headers
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
}

// Convert request body to JSON
String jsonData = objectMapper.writeValueAsString(requestBody);

// Send request
try (OutputStream os = connection.getOutputStream()) {
byte[] input = jsonData.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}

// Get response
int responseCode = connection.getResponseCode();

if (responseCode == 200) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
return new HttpResult(true, responseCode, response.toString());
}
} else {
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
return new HttpResult(false, responseCode, response.toString());
}
}

} catch (Exception e) {
return new HttpResult(false, -1, "Error: " + e.getMessage());
}
}

/**
* Send GET request
*/
private static HttpResult get(String url, Map<String, String> headers) {
try {
URL urlObj = URI.create(url).toURL();
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();

// Set request method and headers
connection.setRequestMethod("GET");
connection.setConnectTimeout(30000);
connection.setReadTimeout(30000);

// Add custom headers
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
}

// Get response
int responseCode = connection.getResponseCode();

if (responseCode == 200) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
return new HttpResult(true, responseCode, response.toString());
}
} else {
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
return new HttpResult(false, responseCode, response.toString());
}
}

} catch (Exception e) {
return new HttpResult(false, -1, "Error: " + e.getMessage());
}
}

/**
* HTTP Result wrapper class
*/
public static class HttpResult {
private final boolean success;
private final int code;
private final String text;

public HttpResult(boolean success, int code, String text) {
this.success = success;
this.code = code;
this.text = text;
}

public boolean isSuccess() {
return success;
}

public int getCode() {
return code;
}

public String getText() {
return text;
}
}
}
What can we do for youWhat can we do for you

FAQ About the template

Google Maps Search API | Extract Search Results via API