Answered

Stock/GetStockItemsFull


 

 I have the following PHP code which successfully retrieves 10 inventory records, however it does not retreive enough detail for what I require;

$authorization = json_decode(Factory::GetResponse("Auth/AuthorizeByApplication", "applicationId=0000f&applicationSecret=000&token=b20081654e36ece7cd913828c0a36301", "", "https://api.linnworks.net/"));
$views = Inventory::GetInventoryViews($authorization->Token, "https://api.linnworks.net/");
$locations = Inventory::GetStockLocations($authorization->Token, "https://api.linnworks.net/");
$locationIds = array();
$inventoryItems = Inventory::GetInventoryItems($views[0],$locationIds,0,10,$authorization->Token,"https://api.linnworks.net/");

 So I was advised by support to use GetStockItemsFull, but I cannot get this to work;

$StockItemsFull = Inventory::GetStockItemsFull($views[0],$locationIds,0,10,$authorization->Token, "https://api.linnworks.net/");

XL9JyrKgba86ABbhaTwmZywDBTamj24Pww.png


What am I doing wrong?  I cannot find any further documentation and Google is empty of help.


Thanks in advance for your assistance


 

 

Hello,

this is raw request I sent to my Database in order to pull channel pricing for an item with a title Matreshka22


 

POST https://ext.linnworks.net//api/Stock/GetStockItemsFull HTTP/1.1
Host: ext.linnworks.net
Connection: keep-alive
Content-Length: 139
Accept: application/json, text/javascript, */*; q=0.01
Origin: https://www.linnworks.net
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Accept-Language: en
Authorization: YOUR TOKEN
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: https://www.linnworks.net/
Accept-Encoding: gzip, deflate, br

keyword=MAtreshka22&loadCompositeParents=true&loadVariationParents=true&entriesPerPage=10&pageNumber=1&dataRequirements=[6]&searchTypes=[1]

 


And this is a response I received:

 

[{"Suppliers":[],"StockLevels":[],"ItemChannelDescriptions":[],"ItemExtendedProperties":[],"ItemChannelTitles":[],"ItemChannelPrices":[{"pkRowId":"8b00c92f-2b76-46ff-9d46-cc6bcc0d1e5a","Source":"EBAY","SubSource":"EBAY0_FR","Price":12321.0,"Tag":null,"StockItemId":"56d7e4d2-6103-4dd8-9cae-6f88ae3a4160"}],"ItemNumber":"100006.1\r\n","ItemTitle":"MAtreshka22","BarcodeNumber":"12345","MetaData":null,"PurchasePrice":0.0,"RetailPrice":null,"TaxRate":0.0,"PostalServiceId":"00000000-0000-0000-0000-000000000000","PostalServiceName":null,"CategoryId":"00000000-0000-0000-0000-000000000000","CategoryName":"Test","PackageGroupId":"00000000-0000-0000-0000-000000000000","PackageGroupName":null,"Height":0.0,"Width":0.0,"Depth":0.0,"Weight":300.0,"StockItemId":"56d7e4d2-6103-4dd8-9cae-6f88ae3a4160"}]

 

You are missing the point, I do not know how to form the call.  This is what I read from what you are telling me, which is clearly wrong because it throws the above mentioned error.

$StockItems = Stock::GetStockItemsFull("keyword=","loadCompositeParents=true","loadVariationParents=true","entriesPerPage=10","&pageNumber=1","dataRequirements=[6]","searchTypes=[1]",$authorization->Token, "https://api.linnworks.net/");
echo "<pre>"; print_r($StockItems); echo "<pre>";

 

Answer

As I can see from our PHP SDK:


 

public static function GetStockItemsFull($keyword,$loadCompositeParents,$loadVariationParents,$entriesPerPage,$pageNumber,$dataRequirements,$searchTypes,$ApiToken, $ApiServer)
{
 return json_decode(Factory::GetResponse("Stock/GetStockItemsFull", "keyword=" . $keyword . "&loadCompositeParents=" . $loadCompositeParents . "&loadVariationParents=" . $loadVariationParents . "&entriesPerPage=" . $entriesPerPage . "&pageNumber=" . $pageNumber . "&dataRequirements=" . json_encode($dataRequirements) . "&searchTypes=" . json_encode($searchTypes) . "", $ApiToken, $ApiServer)); 
}

 


Here is the link to factory:

https://github.com/LinnSystems/LinnworksNetSDK/blob/master/Linnworks/src/php/Factory.php


Login to post a comment