Title: import problem with api
Last modified: March 25, 2017

---

# import problem with api

 *  Resolved [Erfan MHDi](https://wordpress.org/support/users/erfanmhd/)
 * (@erfanmhd)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/import-problem-with-api/)
 * hi,
    i have setup my api key from stockunlocks but when i press the “retrive”
   key in import section nothing happens. no product is adding to my woocommerce
   and no error is showing up !
 * i also created the changes you mentioned in php.ini and wp-confifig but nothing
   happens 🙁
 * can you help me ?!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [StockUnlocks](https://wordpress.org/support/users/stockunlocks/)
 * (@stockunlocks)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8975631)
 * Hi erfanmhd,
 * Can you let me know which version of the StockUnlocks plugin you’re using? In
   the meantime, I’ll check your details on reseller.stockunlocks.com.
 * Thanks
 * Update: I just checked your profile on reseller.stockunlocks.com. It doesn’t 
   look like you’re are making a successful connection to the Dhru server. Are you
   trying to test your connect from a hosted environment or a local computer?
    -  This reply was modified 9 years, 2 months ago by [StockUnlocks](https://wordpress.org/support/users/stockunlocks/).
      Reason: Additional question
 *  Thread Starter [Erfan MHDi](https://wordpress.org/support/users/erfanmhd/)
 * (@erfanmhd)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8978276)
 * Hi Stock Unlocks,
    I’m Using Version 1.0.8.6 from a hosted environment.
 * Thanks
 *  Plugin Author [StockUnlocks](https://wordpress.org/support/users/stockunlocks/)
 * (@stockunlocks)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8978449)
 * I’ve just successfully connected and retrieved services using your credentials
   just fine, no problems.
 * Please take a screen shot of the following and send them to “support at stockunlocks
   dot com”:
 * 1. StockUnlocks > Providers
    2. StockUnlocks > Import Services
 * Also, have you tried clearing your cache or a different browser?
 * It might be helpful to right click on the “Retrieve” button and select “Inspect
   Element”.
 * Next, select the “Network” tab and then click the “Retrieve” button and take 
   note of the network activity from the remote server. Response codes, etc.
 *  Thread Starter [Erfan MHDi](https://wordpress.org/support/users/erfanmhd/)
 * (@erfanmhd)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8980524)
 * Hello,
    i’ve sent the shots to [support@stockunlocks.com](https://wordpress.org/support/topic/import-problem-with-api/support@stockunlocks.com?output_format=md)
   i also check the network tab on inspect area and i got 404 on network requests!
 * i also send the network error screenshot in E-Mail.
 * thanks!
 *  Plugin Author [StockUnlocks](https://wordpress.org/support/users/stockunlocks/)
 * (@stockunlocks)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8982789)
 * The 404 error that appears in the Network tab points directly to this file:
 * /plugins/stockunlocks/js/private/stockunlocks.js
 * Line 5:
 * `var wpajax_url = document.location.protocol + '//' + document.location.host 
   + '/wp-admin/admin-ajax.php';`
 * I can recreate your problem when I’m running WordPress _locally_.
 * This is because `/wp-admin/admin-ajax.php` would need additional info due to 
   local hosting arrangement.
 * For example, my local hosting environment requires that I add `/stockunlocks-
   plugin` because that’s how my local environment is set up.
 * So, here is what line 5 will look like for me, running locally:
 * `var wpajax_url = document.location.protocol + '//' + document.location.host 
   + '/stockunlocks-plugin/wp-admin/admin-ajax.php';`
 * If I do not add `/stockunlocks-plugin`, I get the same 404 error that you receive
   on the Network tab. After adding, it works just fine.
 * Check your URL structure for your environment. The plugin is designed to work
   with the most common structures encountered for a hosted environment.
 * Hope this helps.
 * Regards,
    Henry
 *  Plugin Author [StockUnlocks](https://wordpress.org/support/users/stockunlocks/)
 * (@stockunlocks)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8983140)
 * The next update will fix this problem by extracting the necessary path element:
 *     ```
       	var doc_pathname = '';
       	var suwp_pathname = document.location.pathname.split('/')[1];
   
       	// add the path element, if necessary
       	if( suwp_pathname == 'wp-admin' ) {
       		doc_pathname = '/wp-admin/admin-ajax.php';
       	} else {
       		doc_pathname = '/' + suwp_pathname + '/wp-admin/admin-ajax.php';
       	}
   
       	// setup our wp ajax URL
       	var wpajax_url = document.location.protocol + '//' + document.location.host + doc_pathname;
       ```
   
 * Once this is implemented, there will be no need to edit this file anymore.
 * Thanks for your patience!
 * Take care,
    Henry

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘import problem with api’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/stockunlocks_7a98b6.svg)
 * [StockUnlocks - Mobile and Cell Phone Unlocking](https://wordpress.org/plugins/stockunlocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stockunlocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stockunlocks/)
 * [Active Topics](https://wordpress.org/support/plugin/stockunlocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stockunlocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stockunlocks/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [StockUnlocks](https://wordpress.org/support/users/stockunlocks/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/import-problem-with-api/#post-8983140)
 * Status: resolved