This shows you the differences between two versions of the page.
— |
developer:soap-1.6:methods:getproductinventory [2012/08/04 11:21] (current) tem created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <embed ..:contents/> | ||
+ | ====== getProductInventory ====== | ||
+ | |||
+ | Retrieve all current inventory for a single product | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | This method retrieves an array of [[..:objects:ProductInventory]] objects for the product specified by ProductRefNum. The ProductRefNum is the gateway assigned unique product identifier that was returned by [[addProduct]. [[searchProducts]] can be used to find the ProductRefNum for a product if it is not known. | ||
+ | |||
+ | Each element in the returned array represents the QtyOnHand and QtyOnOrder for each inventory location. For example, if you have inventory in three warehouses, an array with three elements will be returned. | ||
+ | |||
+ | See also [[adjustInventory]] | ||
+ | |||
+ | ===== Syntax ===== | ||
+ | |||
+ | [[..:objects:ProductInventory]] **getProductInvetory** ( [[..:objects:ueSecurityToken]] Token,string ProductRefNum) | ||
+ | |||
+ | ===== Arguments ===== | ||
+ | |||
+ | ^Type ^Name ^Description ^ | ||
+ | |[[..:objects:ueSecurityToken]] |Token |Merchant security token: used to identify merchant and retrieve the custom fields.| | ||
+ | |string |ProductRefNum |Gateway assigned product ID used to pull product details| | ||
+ | |||
+ | ===== Return Value ===== | ||
+ | |||
+ | |[[..:objects:ProductInventory]] |Returns an array of ProductInventory objects. | | ||
+ | |||
+ | ===== Exceptions ===== | ||
+ | |||
+ | The following exceptions (errors) are applicable to this method. | ||
+ | |||
+ | ^Code ^Message ^Advice ^ | ||
+ | |41002 |Product Not Found |Product specified by ProductRefNum was not found. Make sure the number stored is not truncated or rounded. | | ||
+ | |||
+ | ===== Examples ===== | ||
+ | |||
+ | |||
+ | ==== PHP ==== | ||
+ | |||
+ | For directions on how to set up the WSDL link, create "$token" and "$client", go to [[..:howto:php|PHP Soap How-to]]. | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | try { | ||
+ | $ProductRefNum = '912093987473'; | ||
+ | $inventory = $client->getProductInventory($token, $ProductRefNum); | ||
+ | |||
+ | print_r($inventory); | ||
+ | } | ||
+ | |||
+ | catch(SoapFault $e) { | ||
+ | |||
+ | echo $e->getMessage(); | ||
+ | |||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </code> | ||
+ | ==== XML ==== | ||
+ | Request: | ||
+ | <code xml> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <SOAP-ENV:Envelope | ||
+ | xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" | ||
+ | xmlns:ns1="urn:usaepay" | ||
+ | xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
+ | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
+ | xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" | ||
+ | SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | ||
+ | <SOAP-ENV:Body> | ||
+ | <ns1:getProductInventory> | ||
+ | <Token xsi:type="ns1:ueSecurityToken"> | ||
+ | <ClientIP xsi:type="xsd:string">192.168.0.1</ClientIP> | ||
+ | <PinHash xsi:type="ns1:ueHash"> | ||
+ | <HashValue xsi:type="xsd:string">fa10e601d0c6be6c79fce2fdb89f51c65148f8bf</HashValue> | ||
+ | <Seed xsi:type="xsd:string">12693612492090882854</Seed> | ||
+ | <Type xsi:type="xsd:string">sha1</Type> | ||
+ | </PinHash> | ||
+ | <SourceKey xsi:type="xsd:string">1B93L5cpXV5hbx557d183q96EZ2jpqEf</SourceKey> | ||
+ | </Token> | ||
+ | <ProductRefNum xsi:type="xsd:string">9011780645</ProductRefNum> | ||
+ | </ns1:getProductInventory> | ||
+ | </SOAP-ENV:Body> | ||
+ | </SOAP-ENV:Envelope> | ||
+ | </code> | ||
+ | |||
+ | Response: | ||
+ | <code xml> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <SOAP-ENV:Envelope | ||
+ | xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" | ||
+ | xmlns:ns1="urn:usaepay" | ||
+ | xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" | ||
+ | xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
+ | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
+ | SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | ||
+ | <SOAP-ENV:Body> | ||
+ | <ns1:getProductInventoryResponse> | ||
+ | <getProductInventoryReturn SOAP-ENC:arrayType="ns1:ProductInventory[1]" xsi:type="ns1:ProductInventoryArray"> | ||
+ | <item xsi:type="ns1:ProductInventory"> | ||
+ | <InventoryLocation xsi:type="xsd:string">Los Angeles</InventoryLocation> | ||
+ | <QtyOnHand xsi:type="xsd:string">5</QtyOnHand> | ||
+ | <QtyOnOrder xsi:type="xsd:string">25</QtyOnOrder> | ||
+ | <DateAvailable xsi:type="xsd:string">2009-10-10</DateAvailable> | ||
+ | </item> | ||
+ | </getProductInventoryReturn> | ||
+ | </ns1:getProductInventoryResponse> | ||
+ | </SOAP-ENV:Body> | ||
+ | </SOAP-ENV:Envelope> | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Change History ===== | ||
+ | |||
+ | ^Version ^Change ^ | ||
+ | |[[developer:soap-1.3:methods:getproductinventory|1.3]] | Method added in this release | |