Groove Commerce Support Center

Magento API Connectivity

This diagnostic program will make sure that your Magento API is accessible to HubShop.ly. Due to the range of possible store configurations, this test is the most important to confirm HubShop.ly connectivity

What to Look For

null

What it Does

This diagnostic program will perform the following tests in the order given:

  1. Verify server rewrite rules
  2. Verify Magento OAuth authorization endpoint
  3. Verify HubShop.ly authorization endpoint
  4. Verify OAuth access token validation process
  5. Verify Magento REST API products endpoint
  6. Verify HubShop.ly API queue endpoint

Within some tests are series of related tests. They are described in detail at the end of this article.

Possible Statuses

Pass

  • A passing status means that all 6 checkpoints were successfully verified.

Warn

  • A warning status means that an issue was found at one of the checkpoints, and that it may prevent some or all of HubShop.ly from working properly.
  • A warning status will also provide a descriptive reason. Consult the test results table at the end of this article.

Fail

  • A failing status means that one or more of the checkpoints could not be verified, and that HubShop.ly will not function properly.
  • A failing status will also provide a descriptive reason. Consult the test results table at the end of this article.

Dependencies

  • The Enabled test must be passing.
  • The OAuth Consumer test must be passing.

How to Respond to Error Messages

If your test fails or issues a warning, consult the guide below according to the reason given.

Magento API redirect rule was not found.

When given as a warning, the test indicates that an expected server rewrite rule could not be found. Server rewrite rules are required for Magento's REST API to work properly. If this is given as a warning, the program could not locate the expected rules but could not confirm whether this has any impact on the functionality of HubShop.ly. If given as a failure, the program has concluded that this is the cause for a previous failed attempt to verify the REST API products endpoint.

How to Fix

The answer may require the help of your system administrator or an experienced developer. You must confirm that your application employs a RewriteRule directive, if using Apache, or a rewrite directive, if using nginx. The test checks the following locations to verify on your behalf:

Apache: Magento .htaccess file

RewriteRule ^api/rest api.php?type=rest [QSA,L]

Some Magento installations do not have this directive, but it is required to use the REST API. Verify your installation to confirm this line is present.

If your test is not passing, it is because this directive could not be verified.

Nginx: Common nginx.conf files

rewrite ^/api/rest /api.php?type=rest last;

Because Magento does not ship with built-in support for nginx, it is more likely that stores powered by nginx will fail on this checkpoint. The sample given above is a suggested adaptation of the Apache directive. If your application uses a rewrite directive for REST API, it may look different. However, the above is what the diagnostic program will look for in any of the following common locations:

  • /etc/nginx/nginx.conf
  • /etc/nginx/conf.d/*
  • /etc/nginx/sites-enabled/*

It is possible that your application is properly configured for REST API support, but in a different way or in different configuration files. In this case, the test may issue a warning which you can safely ignore.

Handling Multiple Stores & Subfolders

If you have a multi-store setup, or at least one of your store's base URLs is on a subdirectory, you may encounter integration problems. It is important to note that these setups are not officially supported by Magento, and consequently they are not guaranteed to be compatible with the REST API. Because of that, HubShop.ly may not be compatible with your store.

If you are using virtual subfolders and leveraging Apache or nginx rewrites to direct traffic to each of your store views, you may have to increase the complexity of your rewrites to support the REST API in a store-specific way. An example nginx configuration is given below to illustrate the solution.

server {
...
set $custom_uri $request_uri;


if ( $request_uri ~ ^(/wholesale|/private)?(/api/rest.*) ) {
set $custom_uri $2;
}


rewrite ^(/wholesale|/private)?(/api/rest.*) /api.php$2?type=rest last;


location ~ ^/(index|api).php {
...
fastcgi_pass unix:/var/run/php5-fpm.socket;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_URI $custom_uri;
...
}
...
}

In this server block, the REST API is configured to support 3 store views, 2 of which exist on virtual subfolders:

  1. The default store on the base host name
  2. A B2B store on a /wholesale subfolder
  3. A private store on a /private subfolder

In this example, PHP-FPM is used and the REQUEST_URI server variable is modified to re-route all API requests against any store view into the default.

Encountered redirect on authorization endpoint.

This warning indicates that an HTTP redirect was encountered while contacting your Magento OAuth authorization endpoint. This may indicate a problem in the REST API information which your store sends to HubShop.ly for communication. Confirm that your REST API is working properly.

Authorization endpoint could not be reached.

This error indicates that the Magento OAuth authorization endpoint could not be reached successfully. The endpoint attempted is /admin/oauth_authorize/index. The request must yield an HTTP 200, 401, or 403 status code. If any other response code is received, it is likely that your REST API is not properly configured. Confirm that all previous diagnostic tests are passing and test your API manually.

HubShop.ly queue endpoint could not be reached.

This error indicates that HubShop.ly extension authorization endpoint on your store could not be reached successfully. The endpoint attempted is /hubshoply/queue/authenticate. The request must yield an HTTP 200, 401, or 403 status code. If any other response code is received, there may be a problem with your installation. Make sure that there are no server rules which would block requests to this endpoint. You may also try re-installing the extension.

Consumer validation error: ...

This error indicates that the consumer record could not be retrieved. A more precise message should be given which may indicate a code-level problem in your Magento application. If the message is not discernable, you can try to reset your HubShop.ly installation or create the consumer record manually.

Internal server error on consumer validation: ...

This error indicates a fatal server error while trying to retrieve the consumer record. The exact details given should be used to troubleshoot your store. The problem is not likely related to the HubShop.ly extension.

Token validation error: ...

This error indicates that a test access token could not be generated. A more precise message should be given which may indicate a code-level problem in your Magento application. If the message is not discernable, you can try to reset your HubShop.ly installation.

Internal server error on token validation: ...

This error indicates a fatal server error while trying to generate a test access token. The exact details given should be used to troubleshoot your store. The problem is not likely related to the HubShop.ly extension.

Products API test did not succeed.

This error indicates that the Magento REST API products endpoint could not be reached successfully. A fully-compliant OAuth request will be sent using a one-time use access token in order to simulate a request for products. If any other response than an HTTP 200 code is given, the test fails. If failing, you should confirm that your REST API is working. In this case, the problem is not likely related to the HubShop.ly extension.

HubShop.ly token validation error: ...

This error indicates that a special HubShop.ly test access token could not be generated. A more precise message should be given which may indicate a code-level problem in your Magento application. If the message is not discernable, you can try to reset your HubShop.ly installation.

Internal server error on HubShop.ly token validation: ...

This error indicates a fatal server error while trying to generate a special HubShop.ly test access token. The exact details given should be used to troubleshoot your store. The problem is not likely related to the HubShop.ly extension.

HubShop.ly queue test did not succeed.

This error indicates that the HubShop.ly queue endpoint could not be reached successfully. A signed request will be sent using a one-time use access token in order to simulate a request for queued HubShop.ly events. If any other response than an HTTP 200 code is given, the test fails. If failing, you should confirm that request for endpoints behind /hubshoply/queue are not blocked. You may need to contact support for additional help.