Skip to main content
Published: July 09 2010, 5:25:00 PMUpdated: November 28 2020, 8:28:24 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 63861 on US site:

/*
© 2010-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
*/

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

ApiAccount ac = cred.getApiAccount();
ac.setApplication(YOUR-APPID);
ac.setDeveloper(YOUR-DEVID);
ac.setCertificate(YOUR-CERTID);
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("63861", 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 tags

1500 - New without tags

1750 - New with defects
3000 - Pre-owned

Then pick up one of the condition ID, say "New with tags". 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();

...

 


Version Info

The code example above was based on the versions specified below:

API Schema Version

673

Java SDK Version

eBay Java SDK v673 Full Release (for JDK 1.5 and 1.6)

 

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