Java Spring Boot获取Api响应:Ebay Api
我试图使用Ebay API进行测试,但看起来我并没有得到我想要达到的结果 我在控制器中的@GetMapping请求为:Java Spring Boot获取Api响应:Ebay Api,java,spring,spring-boot,ebay-api,Java,Spring,Spring Boot,Ebay Api,我试图使用Ebay API进行测试,但看起来我并没有得到我想要达到的结果 我在控制器中的@GetMapping请求为: @GetMapping(value = "test") public ResponseEntity testLogin(){ RestTemplate restTemplate = new RestTemplate(); String findCompletedItemsUrl = "https://svcs.ebay.com/s
@GetMapping(value = "test")
public ResponseEntity testLogin(){
RestTemplate restTemplate = new RestTemplate();
String findCompletedItemsUrl = "https://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=THIS-IS-MY-APP-ID&OPERATION-NAME=findCompletedItems&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&keywords=iphone%20case&categoryId=9355&sortOrder=PricePlusShippingLowest&itemFilter(0).name=Condition&itemFilter(0).value=1000&itemFilter(1).name=SoldItemsOnly&itemFilter(1).value=true&paginationInput.entriesPerPage=10&outputSelector(0)=SellerInfo&GLOBAL-ID=EBAY-US";
ResponseEntity<String> response = restTemplate.getForEntity(findCompletedItemsUrl,
String.class);
return response;
}
但是,当我尝试使用上述方法访问同一URL时,没有得到任何结果,count属性显示为0。我得到的json如下所示:
{
"findCompletedItemsResponse": [
{
"ack": [
"Success"
],
"version": [
"1.13.0"
],
"timestamp": [
"2020-03-09T21:57:05.206Z"
],
"searchResult": [
{
"@count": "0"
}
],
"paginationOutput": [
{
"pageNumber": [
"0"
],
"entriesPerPage": [
"10"
],
"totalPages": [
"0"
],
"totalEntries": [
"0"
]
}
]
}
]
}
不知道我会错过什么 浏览器的cookie可能会影响您的结果。所以这可能是你回答不同的原因。你检查过这个问题吗
{
"findCompletedItemsResponse": [
{
"ack": [
"Success"
],
"version": [
"1.13.0"
],
"timestamp": [
"2020-03-09T21:57:05.206Z"
],
"searchResult": [
{
"@count": "0"
}
],
"paginationOutput": [
{
"pageNumber": [
"0"
],
"entriesPerPage": [
"10"
],
"totalPages": [
"0"
],
"totalEntries": [
"0"
]
}
]
}
]
}