简体   繁体   中英

Magento REST API /Product Call Returns Empty JSON Arrays

I'm trying to use the Magento REST API to get back a list of all products on my Magento Installation.

I've successfully authenticated using OAuth and I'm calling " LINK TO API /products" -- however it just returns me an array of empty arrays, like so:

{"11":[], "12":[], "13":[], "14":[], "15":[], "16":[], "17":[]}

11, 13, 13 etc are the ID's of the products in my store. So its certainly finding products, however it isn't sending any of the products details along with the IDs, which should be in the JSON arrays associated with the IDs.

Has anyone encountered this issue before and been able to fix it?

Below is the code I'm using to access the API.

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'text/xml'));

Thanks in Advance,

Danny

Danny I would check the ACL for your REST USER, sounds like you haven't given it permission to the specific fields you are looking for. Also I've noticed a bug when using the "All" will act the same as "Custom" with nothing checked.

To Get to these functions go to:

System > Web Services > REST - Attributes
  1. Select the account used for the connection [recommend Admin]
  2. Then verify the [ACL Attribute Rules]
  3. Again use Custom and select each one you want to assure they are stored.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM