WebService
AMap.WebService
Used to call the Web service API, directly passing through query conditions and returning results, providing both GET and POST request methods. For specific request interfaces and return results, please refer to https://lbs.amap.com/api/web-service/overview
Static method
get(path, params, callback, opts)
Request the specified Web service API interface using the GET method
Parameter:
path (string) Interface path of the Web service API
params (object) Query parameters of the Web service API
callback (WebServiceCallback) Query callback function
opts (HttpOptions = {}) HTTP request parameter configuration
Demo:
AMap.WebService.get("https://restapi.amap.com/v3/place/text",
{
keywords: "food",
city: "840380000",
types: "博物馆",
},
function (error, result) {
console.log(error, result);
}
);post(path, params, callback)
Request the specified Web service API endpoint using the POST method
Parameter:
path (string) Endpoint path of the Web service API
params (any) Query parameters of the Web service API
callback (WebServiceCallback) Query callback function