I have an array with some products SKU called "items_estoque", which I fill in a loop from a specific DataTable called dt
:
Dim items_estoque(0) As String
For Each linha As DataRow In dt.Rows
If Not IsDBNull(linha("codigo_magento")) Then
i += 1
ReDim Preserve items_estoque(i)
items_estoque(i) = linha("codigo_magento")
End If
Next
I then call the Magento API using the catalogInventoryStockItemList
function:
Dim estoque = magentoV2_servico.catalogInventoryStockItemList(magentoV2_sessao, items_estoque)
For Each item As MagentoV2_Temp.catalogInventoryStockItemEntity In estoque
'Do stuff
Next
And almost every time I do this, I get an undefined error, independent of the SKU or array length.
The weird thing is that, if I before trying to get those two specific products from the example, make a random call using catalogProductList
, like (Dim produtos = magentoV2_servico.catalogProductList(magentoV2_sessao, filters, "")
), I can then normally go back to that same "catalogInventoryStockItemList" function and it will work:
Why does that happen and, please, how can I solve it?
Okay, forget about it, it turns out it was just a wrong variable in my login parameters (that took me one and a half days to find). I'll leave the question here anyway because it's a little hard to find material about this API around