• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Display JSON data from an api

Scheduled Pinned Locked Moved Requests
15 Posts 6 Posters 8.7k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    yawns Moderator
    last edited by Mar 1, 2017, 9:27 AM

    So this is just a JSON file which is sitting on your raspberry, right?
    The approach would be the same as with the compliments.js module loading a local file with additional statements.
    That shouldn’t be too difficult. I could try to tackle this, but I need to complete another module first which is waiting for so long already … too much to do and no time :(

    L 1 Reply Last reply Mar 1, 2017, 9:31 AM Reply Quote 0
    • L Offline
      looolz @yawns
      last edited by Mar 1, 2017, 9:31 AM

      @yawns Thanks for the reply!

      Well, the JSON-file would be hosted on a server, so a http-path to the file would do the job for sure. A common way to do this that I’ve seen is installing Dropbox on a server, and sharing out the JSON file via a public link.

      O 1 Reply Last reply Mar 1, 2017, 2:58 PM Reply Quote 0
      • O Offline
        ooom416354 @looolz
        last edited by Mar 1, 2017, 2:58 PM

        @looolz I am actually trying to do this also. I have JSON data I’m pulling from an API and am able to present it on a page when I click a button but am not entirely sure how to map this over to an actual MM2 module. I’m trying to follow the documentation and it’s overwhelming for someone with limited JS experience! Is there a generic module already created which can be used to kind of re-point the URL to use any JSON feed, change the returned field names and obviously update the results on the mirror?

        1 Reply Last reply Reply Quote 0
        • Y Offline
          yawns Moderator
          last edited by Mar 1, 2017, 3:50 PM

          :D
          I just noticed @PeppaPigKilla was the one asking for a UbisoftStats display and @looolz was asking for some different usecase

          @looolz: do you have an example of your JSON file?

          1 Reply Last reply Reply Quote 0
          • L Offline
            looolz
            last edited by looolz Mar 1, 2017, 7:43 PM Mar 1, 2017, 7:42 PM

            The big elephant in the room here is that Panic’s StatusBoard did this and is now dead. They discontinued their iPad app in November, and users from all over the world are looking for something to replace it with. MagicMirror is the perfect replacement, but it lacks the most popular module: The Graph Module. When the Graph Module in Statusboard is fed just one number, it displays the number with a name, instead of the graph. I think a good solution would be to base further MMM development based on the same JSON structure that has already been established in the StatusBoard community. Examples:

            {
            
            "graph": {
            
            "title" : "IKKE BEHANDLET",
            
            "total" : true,
            
            "datasequences" : [
            
            {
            
            "title" : "Datasupport",
            
            "datapoints" : [
            
            { "title" : "Antall", "value" : 3 }
            
            ] } ] } }
            

            This will in StatusBoard look like this:
            0_1488397034636_datasupport-ikkebehandlet.jpg

            If however, the same module is used, and pointed to this JSON-file:

            {
            
            "graph" : {
            
            "title" : "Prod-Redigering : antall saker opprettet",
            
            "total" : true,
            
            "datasequences" : [
            
            {
            
            "title" : "Uke 29",
            
            "datapoints" : [
            
            {"title" : "Mandag", "value" : 0 },
            
            {"title" : "Tirsdag", "value" : 4 },
            
            {"title" : "Onsdag", "value" : 0 },
            
            {"title" : "Torsdag" , "value" : 3 },
            
            {"title" : "Fredag", "value" : 2 }
            
            ]
            
            }
            
            ]
            
            }
            
            }
            

            That will produce this nice Column Graph:

            0_1488397213531_produke.jpg

            The whitepaper still exists here: https://library.panic.com/statusboard/graph_tutorial/

            If someone needs motivation to look into this, please check the comments here:
            https://panic.com/blog/the-future-of-status-board/

            1 Reply Last reply Reply Quote 0
            • 1
            • 2
            • 2 / 2
            2 / 2
            • First post
              11/15
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy