16

アプリケーションをmagento管理者に登録しました。

すでにコンシューマーキーとコンシューマーシークレットを取得しています。

しかし、私はアクセストークンとアクセストークンシークレットを取得する運がありません。

と言いました

oauth_problem = parameter_absent&oauth_parameters_absent = oauth_consumer_key

シンプルなRESTAPI

私はこのリンクに基づいてテストしています

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

私が答えを知る必要があるのは

  1. ヘッダーとデータのテキストフィールドに何を入力する必要がありますか?
  2. アクセストークンとアクセスシークレットトークン(Mozilla上)を取得するにはどうすればよいですか?
  3. REST APIをテストするためのチュートリアルステップバイステップはありますか?
4

1 に答える 1

6

0) https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjelooをChromeにインストールします

1)コマンドでoAuthクライアントツールを入手します:

sudo gem install oauth

2)Magentoサーバーをセットアップします

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

于 2012-12-20T04:03:43.503 に答える