LinnSystems / LinnworksNetSDK

Linnworks.net Developers
26 stars 41 forks source link

Api suddenly returns "nothing" for any call. #29

Open Dekari opened 3 years ago

Dekari commented 3 years ago

Hello,

I am using the .net sdk in order to connect to Linn api.

Connection works fine and i got back this object:

Screenshot 2021-09-04 at 1 47 53 PM

I use LinnworksAPI.AuthMethods.AuthorizeByApplication method in order to get the connection object (which seems it's fine).

but then ANY request to Linn api returns "nothing" without any error.

Tried: GetStockLocations GetStockItemsFull GetStockItems

Note: Nothing changed on my .net software...

Besides the above.. I wonder from where i can download the newer (if exists) Linworks.dll??? I stongly believe that "dll" is created based on the code it's on this github repo.

I suspect that "something" has changed in between?

neekfenwick commented 1 year ago

When you say the API returns 'nothing' do you mean you get an empty array response like [], or a completely blank response body? It would help greatly if you showed the exact way you're calling the functions, with what arguments, and exactly what you get back.

I have found the API to have some really weird calling patterns, if you get the syntax slightly wrong it can just return zero results, then you fix one of the query parameters slightly, for example specify an ordering for the results, and it can start working. It's been a year or more since I worked against the API in much detail but here's some PHP code I wrote to call the API through my helper (which basically just uses GuzzleHttp, a standard HTTP request library, to send the request) as documented at https://apps.linnworks.net/Api/Method/Inventory-GetStockItemIdsBySKU:

$lw_api->genericAPICall('POST', 'api/Inventory/GetStockItemIdsBySKU',
        [ 'request' => '{
          "SKUS": [
            "' . $sku . '"
          ]
        }' ]);

I couldn't quite believe that's actually what the body has to look like, but there it is :) It's one of the weirder APIs I've worked with.