2012-11-07 116 views
16

我已經在我的magento管理員上註冊了我的應用程序。如何從Magento 1.7獲取訪問令牌和訪問令牌密鑰REST API

已經獲得消費者的關鍵和消費者的祕密。

但我沒有運氣得到訪問令牌和訪問令牌的祕密。

它說

oauth_problem = parameter_absent & oauth_parameters_absent = oauth_consumer_key

Simple REST API

我正在基於此鏈接

http://www.magentocommerce.com/api/rest/testing_rest_resources.html

上測試

我需要知道答案是

  1. 必須我填什麼到頭&數據文本框是什麼?
  2. 如何獲得訪問令牌和訪問祕密令牌(在Mozilla上)?
  3. 是否有任何教程一步一步來測試任何REST API?
+4

都看到了這個問題的解決 – chanz

+2

是的,我找到了解決辦法chanz –

+0

@ Josua Marcel Chrisano:你可以請通過使用RESTClient向我發送解決方案的鏈接 –

回答

6

0)安裝https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo到Chrome

1)獲取與命令一個OAuth客戶端工具:設置Magento的服務器

sudo gem install oauth 

2)

3)獲取oAuth令牌

oauth \ 
    --verbose \ 
    --query-string \ 
    --consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \ 
    --consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \ 
    --access-token-url http://www.yourstore.com/magento/oauth/token \ 
    --authorize-url http://www.yourstore.com/magento/oauth/authorize \ 
    --request-token-url http://www.yourstore.com/magento/oauth/initiate \ 
    authorize 

迴應:

Server appears to support OAuth 1.0a; enabling support. 
Please visit this url to authorize: 
http://www.yourstore.com/magento/oauth/authorize?oauth_token=ey6fokp0pbzwr1016eb528y5xw1ak5ji 

Please enter the verification code provided by the SP (oauth_verifier): 
YOUR_CODE_HERE 

Response: 
    oauth_token_secret: g9kyz8c7zv868d58eav1muih3gxvq763 
    oauth_token: aqvlfv9tuexn0mqiydgkaff4ixxg8743c 

4)使API調用

oauth \ 
    --consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \ 
    --consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \ 
    --token aqvlfv9tuexn0mqiydgkaff4ixxg8743c \ 
    --secret g9kyz8c7zv868d58eav1muih3gxvq763 \ 
    --uri http://www.yourstore.com/magento/api/rest/products \ 
    debug 

嘗試http://www.yourstore.com/magento/api/rest/products


發現它的解決方案

http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/

爲PHP

https://gist.github.com/2469319