Drupal - Drupal 7 - How do I parse JSON data from a website and import them as Nodes and have them update hourly?

I think you have a problem with the "context", and title query. I've tried this configuration and worked for me.

The context is the first query and in this case just selects all the nodes, the second one takes the value of the key "last" ant put it on the node title.

Then you can play with other querys, to create the nodes, but at least this one works.

enter image description here


Why not just do it custom? Here is an example to get you started. Set your cron on the server to run every hour. This requires entity api

/** implements hook_cron **/
function poloniex_cron(){
 poloniex_get_feed();
}

function poloniex_get_feed(){
 //Get the feed and turn it into json
 $feed = file_get_contents("https://poloniex.com/public?command=returnTicker");
 $feed_json = json_decode($feed);

 foreach($feed_json as $item){
  poloniex_create_node($item);
 }
}

/**$item should be an array from the json feed**/
function poloniex_create_node($item){
  //Create an instance of the node and wrap it
  $node = entity_create('node', array('type' => 'content_type'));
  $node_wrapper = entity_metadata_wrapper('node',$node);

  //Set properties
  $node_wrapper->author = 1; // Admin as the author
  $node_wrapper->title->set("String");  //Title
  $node_wrapper->field_name->set("String"); //Textfield
  $node_wrapper->save();
}

Tags:

7

8

Feeds