private static String USER_TOKEN="YOUR TOKEN";
public static ApiContext createApiContext() {
ApiContext apiContext = new ApiContext();
ApiLogging apiLogging = new ApiLogging();
apiContext.setApiLogging(apiLogging);
CallRetry cr = new CallRetry();
cr.setMaximumRetries(3);
cr.setDelayTime(1000); // Wait for one second between each retry-call.
String[] apiErrorCodes = new String[] { "502" };
// Set trigger exceptions for CallRetry.
cr.setTriggerApiErrorCodes(apiErrorCodes);
// Build a dummy SdkSoapException so that we can get its Class.
Class[] tcs = new Class[] { com.ebay.sdk.SdkSoapException.class };
cr.setTriggerExceptions(tcs);
apiContext.setCallRetry(cr);
apiContext.setTimeout(180000);
ApiCredential cred = new ApiCredential();
// set the server url. Pointing to Sandbox
apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");
// Send UUID with the request
request.setAutoSetItemUUID(true);
ItemType item = new ItemType();
item.setConditionID(1000);
item.setTitle("Testing item. Dont bid");
item.setDescription("Testing item. Dont bid");
item.setSite(SiteCodeType.UK);
// set the item condition depending on the value from
// GetCategoryFeatures
item.setConditionID(1000);