fbpx
News on Magicbit
MagicBlocks Project

News on Magicbit

Make Magicbit display upto date News.

Introduction

In this lesson, we will use a Magicbit board to display the latest News Headings. We will use an API service to obtain the latest news on Stocks. We have used API services before in previous lessons.

Intended Learning Outcomes

  • You will learn how to handle News API.
  • You will learn how to give a display output to the Magicbit.

Setting up the Nodes

First, you need the below nodes.

       

Make the following arrangement.

Configuring the Inject Node.

Double click on it to access its settings. Make the below settings.

Now, let’s configure the HTTP request block.

  • Enter Method as GET.
  • Set the return field as “a parsed JSON object”
  • Paste the given link on the URL field:

https://newsapi.org/v2/everything?q=srilanka&from=2022-07-10&sortBy=popularity&language=en&apiKey=834b138c4b294279acb47fb0e38b1300

Function Node

Enter the given code in the Function.

var title = msg.payload.articles[1].title

msg.payload = "Title: : "+ title;
msg.topic = "";

return msg;

Template Node

Enter the below settings.

Display Node

Connect the Magicbit board with the Magicblocks platform.

Enter the Device(Board) ID.  You can see your device ID in the devices tab.

Related Posts
Leave a Reply