Skip to main content
Published: August 10 2010, 11:36:00 PMUpdated: November 28 2020, 8:33:50 PM

ReviseInventoryStatus an efficient light-weight call that we recommend sellers use when they want to revise price and/or quantity of their fixed-price listing. The call allows you to revise these parameters for 4 items in a single request.

Here is a Java ReviseInventoryStatus sample. This sample has been written using the Java SDK v673


Below is the code.

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

package com.ebay.sample;

import com.ebay.sdk.ApiContext;
import com.ebay.sdk.ApiCredential;
import com.ebay.sdk.ApiException;
import com.ebay.sdk.SdkException;
import com.ebay.sdk.call.ReviseInventoryStatusCall;
import com.ebay.soap.eBLBaseComponents.AmountType;
import com.ebay.soap.eBLBaseComponents.CurrencyCodeType;
import com.ebay.soap.eBLBaseComponents.InventoryStatusType;
import com.ebay.soap.eBLBaseComponents.SiteCodeType;

/**
* Sample code for ReviseInventoryStatus API using eBay Java SDK.
*
* Steps for creating a successful ReviseInventoryStatus call.
*
* 1. Create API Context and set the right credentials.
* 2. Create one InventoryStatusType object for each SKU/Item to be updated.
* 3. Do the necessary changes to the InventoryStatusType object. For setting price, an AmountType object is needed.
* 4. Add all the InventoryStatusType objects to an InventoryStatusType array.
* 5. Set this array to the ReviseInventoryStatusCall object with setInventoryStatus().
* 6. Call the ReviseInventoryStatusCall#reviseInventoryStatus() method.
*
* The following code sample updates inventory (quantity, price or both) for four items belonging to a user.
*/
public class ReviseInventoryStatusSample {

     public static void reviseInventoryStatus() {
          ApiContext apiContext = new ApiContext(); // Create a new APIContext Object
          
          // set Api Token to access eBay Api Server
          ApiCredential cred = apiContext.getApiCredential();
          cred.seteBayToken("YourAuthToken");
          
          apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");// Pointing to SandBox for testing
          
          // Enable logging of SOAP requests and responses. Recommended only for testing/debugging.
          apiContext.getApiLogging().setLogSOAPMessages(true);
          
          apiContext.setSite(SiteCodeType.UK); // Set site to UK
          
          // Create a new ReviseInventoryStatusCall and initialize it with the APIContext
          ReviseInventoryStatusCall risCall = new ReviseInventoryStatusCall(
                    apiContext);

          // Revise quantity and price
          InventoryStatusType invStatus1 = new InventoryStatusType();
          invStatus1.setSKU("CODE_SAMPLE_REVISE_INVSTAT_SKU1");

          AmountType newAmtForSKU1 = new AmountType();
          newAmtForSKU1.setCurrencyID(CurrencyCodeType.GBP);
          newAmtForSKU1.setValue(15.00);
          invStatus1.setStartPrice(newAmtForSKU1);
          invStatus1.setQuantity(2);

          InventoryStatusType invStatus2 = new InventoryStatusType();
          invStatus2.setSKU("CODE_SAMPLE_REVISE_INVSTAT_SKU2");

          AmountType newAmtForSKU2 = new AmountType();
          newAmtForSKU2.setCurrencyID(CurrencyCodeType.GBP);
          newAmtForSKU2.setValue(10);
          invStatus2.setStartPrice(newAmtForSKU2);
          invStatus2.setQuantity(30);

          // Revise Price Only
          InventoryStatusType invStatus3 = new InventoryStatusType();
          invStatus3.setSKU("CODE_SAMPLE_REVISE_INVSTAT_SKU3");

          AmountType newAmtForSKU3 = new AmountType();
          newAmtForSKU3.setCurrencyID(CurrencyCodeType.GBP);
          newAmtForSKU3.setValue(5.00);
          invStatus3.setStartPrice(newAmtForSKU3);

          // Revise Quantity Only
          InventoryStatusType invStatus4 = new InventoryStatusType();
          invStatus4.setSKU("CODE_SAMPLE_REVISE_INVSTAT_SKU4");
          invStatus4.setQuantity(20);

          // Add all the items to be revised, to an array.
          InventoryStatusType[] invStatuses = new InventoryStatusType[] {
                    invStatus1, invStatus2, invStatus3, invStatus4 };
          
          // Add exception handling - Most of these exceptions can be fatal.
          try {
               risCall.setInventoryStatus(invStatuses);// add the array to the main call
               risCall.reviseInventoryStatus();
          } catch (ApiException e) {
               e.printStackTrace();
          } catch (SdkException e) {
               e.printStackTrace();
          } catch (Exception e) {
               e.printStackTrace();
          }

     }

     public static void main(String[] args) {
          reviseInventoryStatus();
     }

}

The request XML is attached to this article. You can use the API test tool to execute the request in sandbox and see how it works.

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