I am trying to use Ebay API for testing purposes, but it looks like I am not getting the results I am trying to achieve.
I have this @GetMapping
request in my controller as:
@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;
}
Please note the URL has a placeholder of APP ID. When I access the URL through the browser I get the following results:
{
"findCompletedItemsResponse": [
{
"ack": [
"Success"
],
"version": [
"1.13.0"
],
"timestamp": [
"2020-03-09T21:54:58.595Z"
],
"searchResult": [
{
"@count": "1",
"item": [
{
"itemId": [
"174129065971"
],
"title": [
"For Apple iPhone 8 Plus Case Shock Absorption Cover Shockproof Bumper Rose"
],
...cut for brevity
}
]
}
But when I try to access the same URL using the above method, I get no results and the count property is showing 0. The json I get back is below:
{
"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"
]
}
]
}
]
}
Not sure what I could be missing!