Title: Import JSON
Last modified: March 4, 2021

---

# Import JSON

 *  Resolved [bigdrop.gr](https://wordpress.org/support/users/bigdropgr/)
 * (@bigdropgr)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/import-json-3/)
 * Hi,
 * I do understand that my question is out of the scope of this support and I apologize
   in advance.
 * My first question is if I can import JSON files. As I read on your website the
   answer is yes.
 * My second and most important question is:
 * A vendor I am working with, has a magento based store.
    He is providing me with
   API (for fetching and updating products). I want to print the JSON file. The 
   vendor provided me with a php sample file and asked me to use it. Unfortunately
   I am not familiar with this and I need help. So the task is to create a php file
   that will print the JSON. Then upload the file on my server and use it as a URL
   in order to import and update products.
 * This is the content of the php sample file:
 *     ```
       <?php
   
       $base_url = 'https://www.inart.com/';
       $gr_url   = $base_url . 'api/rest/products/store/1';   //Products in Greek language
       $en_url   = $base_url . 'api/rest/products/store/2';   //Products in English Language
   
       $consumer_key    = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX';
       $consumer_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX';
       $token           = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX';
       $token_secret    = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX';
   
       $parameters = array();
   
       $headers    = array(
           'Content-Type' => 'application/json',
           'Accept'       => 'application/json'
       );
   
       $filters    = array(
           //Number of products per page (Default 10, Max 100)
           'limit' => 20,
           //Number of page to fetch
           'page'  => 1
       ); 
       //For more filters visit: http://devdocs.magento.com/guides/m1x/api/rest/get_filters.html
   
       $url = $gr_url . '?' . http_build_query($filters);
   
       try {
           $oauthClient = new OAuth($consumer_key, $consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
   
           $oauthClient->setToken($token, $token_secret);
   
           $oauthClient->fetch($url, $parameters, OAUTH_HTTP_METHOD_GET, $headers);
   
           $json = $oauthClient->getLastResponse();
   
           echo $json;
       } catch (Exception $e) {
           echo $e->getMessage();
       }
       ```
   
 * Can you please help me with that?
    Or at least point me to the right direction…
 * Thank you!

Viewing 1 replies (of 1 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/import-json-3/#post-14144133)
 * Hi [@bigdropgr](https://wordpress.org/support/users/bigdropgr/),
 * > My first question is if I can import JSON files. As I read on your website 
   > the answer is yes.
 * Yes.
 * > So the task is to create a php file that will print the JSON. Then upload the
   > file on my server and use it as a URL in order to import and update products.
 * Unfortunately, we wouldn’t be able to help modify this PHP script to work with
   the API and create a feed. But, I can leave this thread open for you in case 
   anyone is able to help.

Viewing 1 replies (of 1 total)

The topic ‘Import JSON’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/import-json-3/#post-14144133)
 * Status: resolved