5

Hello I'm trying to use Magento 2 Rest and Soap integrations when I try to activate my integration I get the error Unable to post data to the consumer due to an unexpected error

these are my current settings.

When I change the callback url to https://www.google.com then I receive a message Please set up or sign in into your 3rd party account to complete the setup of this integration.

enter image description here

1
  • No need to add the callback URL. You can use the authorized token which is been generated when you activate the integration to access the data. Have you tried that? Commented Dec 23, 2019 at 14:05

2 Answers 2

0

These steps below show how to use an admin user to get an API authentication and how to use it.

But you can find all APIs URLs accessing this URL on your store:

www.yourstore.com.br/swagger/

To see all administrator methods (not only the guest methods), you can paste the api_key on the top right of the page and click to apply, this api_key is the key returned in step 1 below.

Step-by-Step

1 - Get your authentication token if this command, the token no expiry it just can be invalidated. Change the ADMIN_USER and PASSWORD_USER to yours.

curl -X POST \
  http://yourstore.com/rest/default/V1/integration/admin/token \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "username": "ADMIN_USER",
    "password": "PASSWORD_USER"
}'

2 - To check your connection you can get the list of the installed modules using this command below. You must change the XXXXXX_TOKEN_HERE_XXXX to use your token returned in step 1.

curl -X GET \
  http://yourstore.com/index.php/rest/V1/modules \
  -H 'authorization: Bearer XXXXXX_TOKEN_HERE_XXXX' \
  -H 'cache-control: no-cache' \
  -d '{
    "searchCriteria": {
        "currentPage": 0
    }
}'
0

Use the api key generated when you create an integrations account and use that to sign in to Swagger using the box in the top right of Swagger.

Now check Swagger actually loads. If you have extended Magento with your own API methods then Swagger can be broken. Log in to Swagger and if your API calls are present then test them. Once you have working calls via Swagger you can review your integration code to see what data is missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.