












import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 搜图_搜狗图片 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "https://jmrgzn2stsgyp.api.bdymkt.com/image/search/sougou"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/x-www-form-urlencoded"); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }点击复制代码
{
"code": 200, //返回码,详见返回码说明
"msg": "成功", //返回码对应描述
"taskNo": "079281571242673018285611", //本次请求号
"charge": true,//计费标志
"data": [
{
"hoverUrl": "https://i01piccdn.sogoucdn.com/d0895517d350739f"//图片链接
}
]
}
{
"code": 400,
"msg": "关键字不能为空"
}

