Import JSON
-
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!
The topic ‘Import JSON’ is closed to new replies.