2

I try get products from magento rest api by several id. But don't understand how make this correct. Now I use this approach for make filters:

api/rest/products/?filter[0][attribute]=entity_id&filter[0][in][0]=564&filter[0][in][1]=563

This filter works but only when it consist from 10 id. If I make filter from great than 10 id then magento will give me:

{"messages":{"error":[{"code":401,"message":"oauth_problem=signature_invalid"}]}}

success request:

/api/rest/products?filter[0][in][4]=244&filter[0][in][6]=246&filter[0][in][7]=250&filter[0][in][9]=248&filter[0][in][8]=249&filter[0][in][1]=243&dir=asc&filter[0][in][0]=241&filter[0][in][2]=242&filter[0][in][3]=245&filter[0][in][5]=247&order=entity_id&filter[0][attribute]=entity_id

fail request:

/api/rest/products?filter[0][in][4]=244&filter[0][in][6]=246&filter[0][in][7]=250&filter[0][in][9]=248&filter[0][in][10]=256&filter[0][in][8]=249&filter[0][in][1]=243&dir=asc&filter[0][in][0]=241&filter[0][in][2]=242&filter[0][in][3]=245&filter[0][in][5]=247&order=entity_id&filter[0][attribute]=entity_id

How will correct filter make for get request?

I don't use in filter 'from' and 'to' for id because my id is not range(not 1,2,3,4, but 34, 1, 99, 45). Therefore I use each id for receive objects.

Seems I found reason. I use python lib rauth for make request to magento rest api. When I choose signature HmacSha1Signature then occur this issue. Seems that rauth not correct calculated signature when used HmacSha1Signature in my case. I tried use RsaSha1Signature but magento send 500 code if used this signature. Now I use PlaintextSignature it's work correct. Later I will find issue in rauth calculating signature because I need signature.

Greg Eremeev
  • 1,760
  • 5
  • 23
  • 33
  • This worked for me also. Thank you for posting the fix/workaround, how frustrating indeed. I am using npm request, which seems to have the same bug as the python lib rauth somehow. – Joshua Lawrence Austill Nov 01 '16 at 18:58

0 Answers0