Welcome Guest. Sign in or Signup

1 Answers

Java SDK: AddFixedPriceItem sample for listing an item with product identifier (ePID) in US

Asked by: 232 views Programming

Java SDK AddFixedPriceItem sample for listing an item with an product identifier (ePID).

import com.ebay.sdk.*;
import com.ebay.sdk.call.*;
import com.ebay.soap.eBLBaseComponents.*;

public class AppAddItemWithePID {

    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(120000);

        // set the server url and credentials for Sandbox
        apiContext.setApiServerUrl(“https://api.sandbox.ebay.com/wsapi”);
        ApiCredential cred = apiContext.getApiCredential();
        cred.seteBayToken(“YOUR TOKEN”);
        apiContext.setApiCredential(cred);

        // Set site to US
        apiContext.setSite(SiteCodeType.US); 

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

        return apiContext;
    }

    private static FeesType addFixedItem() throws ApiException, SdkException, Exception {

        FeesType fee = null;
        AddFixedPriceItemCall request = new AddFixedPriceItemCall(createApiContext());

        ItemType item = new ItemType();
        item.setTitle(“Testing item. Dont bid”);
        item.setDescription(“Testing item. Dont bid”);

        // set the item condition depending on the value from GetCategoryFeatures
        item.setConditionID(1000);

        item.setPostalCode(“95125”);
        item.setListingDuration(“GTC”);

        // Track inventory by SKU
        item.setInventoryTrackingMethod(InventoryTrackingMethodCodeType.SKU);

        // Specify unique SKU
        item.setSKU(“PRODGPSSystems2”);

   &#16