문제

i am working with paypal integration in android application. My question is, how to make a call to the paypal's example access token request to view the response.That means can i call that cURL request via Browser like normal api request? If no means,How can i get the response like below?

Example access token request:

curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
  -H "Accept: application/json" \
  -H "Accept-Language: en_US" \
  -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" \
  -d "grant_type=client_credentials"

Sample response:

{
  "scope": "https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/vault/credit-card/.*",
  "access_token": "{accessToken}",
  "token_type": "Bearer",
  "app_id": "APP-6XR95014SS315863X",
  "expires_in": 28800
}
도움이 되었습니까?

해결책

You can do that with Postman Client chrome extension. Install extension and provide details like below;

enter image description here

And click send button. Important point here;

-H will be sent in header fields,

-u needs to be convert like below and send s in header;

Authorization: Basic base64_encode(username:password) in your case it will be;

Basic RU9KMlMtWjZPb05fbGVfS1MxZDc1d3NaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA6RUNsdXNNRVVrOGU5aWhJN1pkVkxGNWNaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA=

-d will be sent as url-form-encoded form.

Alternatively you can perform this action by using Git Bash. Install Git Bash from here

And open git bash terminal, and copy/paste your curl query like below;

enter image description here

enter image description here

다른 팁

curl and tar were added natively to Windows 10 Insider build 17063. For older version of windows it's still possible to install curl on Windows manually.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top