I want to use the eBay-API to get my sold items. Here is my code:
ApiContext apiContext = new ApiContext();
ApiCredential credential = apiContext.getApiCredential();
ApiAccount acc = new ApiAccount();
acc.setApplication("app-id");
acc.setDeveloper("dev-id");
acc.setCertificate("cert");
eBayAccount eBayAccount = new eBayAccount();
eBayAccount.setPassword("ebay user");
eBayAccount.setUsername("ebay password");
credential.setApiAccount(acc);
credential.seteBayAccount(eBayAccount);
apiContext.setApiServerUrl("https://api.ebay.com/wsapi");
GetMyeBaySellingCall call = new GetMyeBaySellingCall(apiContext);
GetMyeBaySellingRequestType requestType = new GetMyeBaySellingRequestType();
call.setMyeBaySellingRequest(requestType);
ItemListCustomizationType lc = new ItemListCustomizationType();
lc.setInclude(new Boolean(true));
lc.setIncludeNotes(new Boolean(true));
lc.setSort(ItemSortTypeCodeType.BID_COUNT);
requestType.setActiveList(lc);
lc = new ItemListCustomizationType();
lc.setInclude(new Boolean(true));
lc.setIncludeNotes(new Boolean(true));
lc.setSort(ItemSortTypeCodeType.PRICE);
requestType.setSoldList(lc);
lc = new ItemListCustomizationType();
lc.setInclude(new Boolean(true));
lc.setIncludeNotes(new Boolean(true));
lc.setSort(ItemSortTypeCodeType.END_TIME);
requestType.setUnsoldList(lc);
lc = new ItemListCustomizationType();
lc.setInclude(new Boolean(true));
lc.setIncludeNotes(new Boolean(true));
lc.setSort(ItemSortTypeCodeType.START_TIME);
requestType.setScheduledList(lc);
call.getMyeBaySelling();
GetMyeBaySellingResponseType resp = call.getReturnedMyeBaySellingResponse();
The APIAccount
is configured with the data from the developers site of ebay, the eBayAccount
is filled with the credentials of the account I want to fetch items for. However, this results in the following exception:
Exception in thread "main" com.ebay.sdk.SdkSoapException: No XML <RequestPassword> or <RequestToken> was found in XML Request.
at com.ebay.sdk.SdkSoapException.fromSOAPFaultException(Unknown Source)
at com.ebay.sdk.ApiCall.executeByApiName(Unknown Source)
at com.ebay.sdk.ApiCall.execute(Unknown Source)
at com.ebay.sdk.call.GetMyeBaySellingCall.getMyeBaySelling(GetMyeBaySellingCall.java:150)
The user is authenticated for the application and the API-URL is correct. Also, app and user are authenticated for production.
2
Answers
I’d like to give a more detailed example. My app downloads orders from eBay for my account (and my account only). In this case, I do not need to provide App ID, Dev ID or Cert ID. I only need to generate Auth’n’Auth token on eBay and use that as my credential.
Azure function:
The
apiContext()
method is defined as follows:And just in case you need it…
You can get the “eBay token” at https://developer.ebay.com/my/auth/?env=production (as of 12/25/2019).
Here’s what the screen looks like: