incidence

Digitalblend-CL

Firefox REST Client and Magento...

If you have setup Magent0 REST and OAuth you may have noticed in Magento's introduction to REST API that you can use a Firefox REST Client to access the information, they are correct, I had problems with the earlier client like some other user around the web have experienced, now that Version 2 is out I have had more success with the REST Client accessing Magento's REST API in the eCommerce site. Once OAuth is properly setup, accessing the site is actually very easy.

 

Enable Guest Role

If you already have OAuth and REST working on the second server, you don't need to use the Guest Role, since you will have the Authentication Key and the Consumer Keys that are require to use the FireFox Client as a Customer. you can skip the setup of the Guest Role.

If you are using the Firefox REST Client plugin, and want to test things out then you can enable the Guest Role in your Magento store, you will not be able to access as much information as a Admin or Customer, but you will be able to see how the REST Works. Navigate to the REST Attribute rules menu for the Guest Role and select the desired Guest Resource Access level from the menu and select all from the drop down.

Once this is done, go to the REST Role menu and select guest.

In The Role resources menu select all or you can check off the functions you want to allow the guest to have access to.

When you are done click Save.

Important!

For all of this to work, either Pear http_oauth or PECL OAuth have to be properly installed and configured, I am assuming that you have properly installed the package, YUM and PECL are all up to date. Otherwise all of this is for not.

Using the Firefox REST Client

Using the Firefox REST Plugin is very easy, once the Guest Role has been activated or you have proper authentication as a administrator. But if you are trying to use the REST Client as a Admin or Customer you will have to have a the Authentication key setup on a separate server that has OAUTH 1.0 or 2.0 setup properly. Once the Authentication key is setup and you have the Consumer key you will be able to access the information on your Magento Store.

REST Client Firefox Plugin website.

Below is a example of a Magento REST API URL, you will replace Magentohost with the domain of your Magento eCommerce Site. You can visit this Magento Article for more information on the other REST URLS, click here to view the article.

http://magentohost/api/rest/products

When you begin, you will need to enter a REST API URL into the URL text field and click send, if you are successful in connecting to the Magento Store, you will see something similar to the Image below, the header information for the XML feed will appear in the Response Headers tab.

As you can see there are a row of tabs running across the page below the body text field, there will be one Response Header and three Response Body tabs, to view the information that is in the feed click on one of the Response Body Tab and you will see information as seen in the information below. The product information that the Guest User is allowed to view will be displayed in the Response Body Tab.

Through out this article, I am assuming that you are using guest access, but if you have properly setup OAuth on a separate server, you can use the Customer Consumer and Authentication Key to view the store product information with the REST Client, you will need to click on the Authentication Drop down Menu and select Auth, right now Magento REST OAuth supports OAuth 1.0 only.

In the Modal window enter the four pieces of required information. In order to view the Magento store info as a Admin or Customer, you will need to get the matching Access token and secret.When you have done this, you can enter all for pieces of information and click Insert. Once this is done, you can cut and past the REST URL into the URL text field and click get.

If you don't know your Authorization Token and Secret, then you will have to go into the MySQL database and get the information there, Magento's Admin interface does not provide this information.

When you have fully authenticated your customer privileges, you can view the orders you can view the orders that have been placed, comments, address information on a specific order or items that you ordered.