2012-11-07 169 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

相关问题