Welcome Guest. Sign in or Signup

1 Answers

Java SDK: AddFixedPriceItem sample for multi-variation listings in US

Asked by: 364 views Programming

 

Java SDK AddFixedPriceItem sample for multi-variation listings in US.

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

public class AppAddFixedPriceItemWithMultiVariation {

    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”);

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.

        // set API Token to access eBay API Server
        ApiCredential cred = apiContext.getApiCredential();
        cred.seteBayToken(“YOUR TOKEN”);
        apiContext.setApiCredential(cred);

        // set the site
        apiContext.setSite(SiteCodeType.US);

        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.setInventoryTrackingM