Skip to main content
Published: December 22 2006, 3:15:00 PMUpdated: November 28 2020, 3:10:00 PM

How can I make a ReviseItem call using the PHP Accelerator Toolkit?

Summary

The following script demonstrates how to use the eBay Accelerator Toolkit for PHP to make ReviseItem API Call.  Please see this link for information regarding Support for the Accelerator Toolkit for PHP


Detailed Description

Use the script below to make a ReviseItem call, changing the Item StartPrice, BuyItNowPrice, Title, and Listing Duration using the Accelerator Toolkit for PHP.  Change the include filepaths and ebay.config.php filepath as needed.

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

 

<?php
 error_reporting(E_ALL ^ E_NOTICE);

 require_once 'C:\Program Files\Apache Group\Apache2\htdocs\ebatns475\EbatNs_ServiceProxy.php';
 require_once 'C:\Program Files\Apache Group\Apache2\htdocs\ebatns475\EbatNs_Logger.php';
 require_once 'C:\Program Files\Apache Group\Apache2\htdocs\ebatns475\ReviseItemRequestType.php';
 require_once 'C:\Program Files\Apache Group\Apache2\htdocs\ebatns475\ReviseItemResponseType.php';
 require_once 'C:\Program Files\Apache Group\Apache2\htdocs\ebatns475\ItemType.php';
 
 $session = new EbatNs_Session('config/ebay.config.php');
 
 $cs = new EbatNs_ServiceProxy($session);
 
 $logger = new EbatNs_Logger(true);
 
 //$cs->attachLogger($logger);
 
 $cs = new EbatNs_ServiceProxy($session);
 $cs->_logger = new EbatNs_Logger();
 
 $req = new ReviseItemRequestType();
 
 $item = new ItemType();

 // Set the Item ID
 $item->ItemID = '150073717755';

 // Revise the Auction Starting Price and Buy It Now Price
 $item->StartPrice = new AmountType();
 $item->StartPrice->setTypeValue('5.0');
 $item->StartPrice->setTypeAttribute('currencyID', 'USD');
 $item->BuyItNowPrice = new AmountType();
 $item->BuyItNowPrice->setTypeValue('20.0');
 $item->BuyItNowPrice->setTypeAttribute('currencyID', 'USD');

 // Revise the Item Title and Description
 //$item->Description = 'Revised: This is a Test Item. Please do not bid.';
 $item->Title = 'Revised: TEST ITEM DO NOT BID';

 // Set Listing Properties
 $item->ListingDuration = 'Days_10';
 $item->Quantity = 1;
 
 $req->Item = $item;
 
 $res = $cs->ReviseItem($req);

 if ($res->getAck() != $Facet_AckCodeType->Success)
 {
  echo "Call Failure<br>";
  foreach ($res->getErrors() as $error)
  {
   echo "#" . $error->getErrorCode() . " " . htmlentities($error->getShortMessage()) . "/" . htmlentities($error->getLongMessage()) . "<br>";
  } 
 }
 else
 {
  echo "Call Successful<br>";

  // Echo The Item ID and Fees
  print_r("The Item ID is ".$res->ItemID.'<br>');

  $fees = new FeesType();
  $fees = $res->GetFees();
  foreach ($fees->getFee() as $fee)
  {
   echo 'FeeName: '.$fee->GetName(). ' is '. $fee->GetFee()->getTypeValue().' '.$fee->GetFee()->getTypeAttribute('currencyID').'<br>';

  }

  // Echo any Warnings - call can be successful but with warnings
  foreach ($res->getErrors() as $error)
  {
   echo "#" . $error->getErrorCode() . " " . htmlentities($error->getShortMessage()) . "/" . htmlentities($error->getLongMessage()) . "<br>";
  } 


  
 }
 
?>

Version Info

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

API Schema Version  475
 Accelerator Toolkit for PHP   475

 

 

 

Additional Resources

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