Skip to main content
Published: July 09 2010, 5:25:00 PMUpdated: August 16 2022, 7:15:31 PM

How can I find the condition IDs for a specified category and upload an item with one of the IDs?

Summary

Make a call to GetCategoryFeatures to get the available item condition definition, then pass one of the condition ID in AddItem or ReviseItem call.

Here is a sample based on Java SDK to call GetCategoryFeatures. We specified the category to 147285 on US site:

package com.ebay.test;
import com.ebay.sdk.ApiAccount;
import com.ebay.sdk.ApiContext;
import com.ebay.sdk.ApiCredential;
import com.ebay.sdk.ApiLogging;
import com.ebay.sdk.CallRetry;
import com.ebay.sdk.call.GetCategoryFeaturesCall;
import com.ebay.soap.eBLBaseComponents.CategoryFeatureType;
import com.ebay.soap.eBLBaseComponents.ConditionEnabledCodeType;
import com.ebay.soap.eBLBaseComponents.ConditionType;
import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
import com.ebay.soap.eBLBaseComponents.SiteCodeType;

 

public class AppGetCategoryFeatures {

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();
apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");
// apiContext.setApiServerUrl("https://api.ebay.com/wsapi");
cred.seteBayToken(YOUR-TOKEN);
apiContext.setApiCredential(cred);

return apiContext;

}

 

private static GetCategoryFeaturesCall getCatFeature(String categoryId, SiteCodeType site) {

 

GetCategoryFeaturesCall request = new GetCategoryFeaturesCall(
createApiContext());
request.setSite(site);
request.setDetailLevel(new DetailLevelCodeType[] { DetailLevelCodeType.RETURN_ALL });

request.setCategoryID(categoryId);
request.setOutputSelector(new String[] {
"Category.ConditionEnabled",
"Category.ConditionValues.Condition.ID",
"Category.ConditionValues.Condition.DisplayName" });

try {

         request.getCategoryFeatures();

} catch (Exception e) {
    e.printStackTrace();
}

return request;

}

 

public static void main(String[] args) {

 

GetCategoryFeaturesCall cf = getCatFeature("147285", SiteCodeType.US);

 

/*
* Since we call GetCategoryFeatures for a specified category, so we
* just get the first category element here
*/

CategoryFeatureType feature = cf.getReturnedCategory()[0];

 

/*
* If condition Enabled is disabled, then DO NOT pass conditionID in
* AddItem or ReviseItem for this category
*/

if (feature.getConditionEnabled().equals(ConditionEnabledCodeType.ENABLED)) {

for (ConditionType con : feature.getConditionValues().getCondition())

System.out.println(con.getID() + " - " + con.getDisplayName());
}

 

}

 

}

After run the code, you will see the condition ID definition for this category as:

 

1000 - New with box

1500 - New without box

1750 - New with defects
3000 - Pre-owned

Then pick up one of the condition ID, say "New". So we have to pass condtionID "1000" in the AddItem or ReviseItem Call:

 

 

...

AddItemCall request = new AddItemCall(createApiContext());
ItemType item = new ItemType();
item.setConditionID(1000);

...

 

request.setItem(item);
request.addItem();

...

 


 

 

 

How well did this answer your question?
Answers others found helpful

Got thoughts? Click the feedback button – your insights help us improve!