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.

    New to building modules. plz help

    Scheduled Pinned Locked Moved Development
    18 Posts 2 Posters 3.9k Views 2 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.
    • D Offline
      Djninja926 @sdetweil
      last edited by

      @sdetweil I used this link https://stats.foldingathome.org/api/donor/Apia_Okorafor but after I replaced that link it doesn’t work.

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil
        last edited by

        yeh, there is some difficult cors (cross site scripting security) problem

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @sdetweil
          last edited by sdetweil

          @Djninja926 to get the api request to work, I had to add a proxy handler

                  var urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor";
          	var proxyUrl = 'https://cors-anywhere.herokuapp.com/'
          	fetch(proxyUrl+urlApi,
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            Djninja926 @sdetweil
            last edited by

            @sdetweil where do I add the code

            var urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor";
            	var proxyUrl = 'https://cors-anywhere.herokuapp.com/'
            	fetch(proxyUrl+urlApi,
            
            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Djninja926
              last edited by

              @Djninja926 sorry, I was trying different things, forgot that I changed the request function,
              back to the original source

              		var urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor"
              		var proxyUrl = 'https://cors-anywhere.herokuapp.com/'		// added
              		var retry = true;
              
              		var dataRequest = new XMLHttpRequest();
              		dataRequest.open("GET", proxyUrl+urlApi, true);                      // changed
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                Djninja926 @sdetweil
                last edited by

                @sdetweil I did all that and this was the output
                Captursde.PNG
                Capturade.PNG
                I think It is working so what do i do know.

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @Djninja926
                  last edited by

                  @Djninja926 figure out the data differences from the 1st api used to the new one, and how you have to fix the output format

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    Djninja926 @sdetweil
                    last edited by

                    @sdetweil I dont get what you mean

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Djninja926
                      last edited by sdetweil

                      @Djninja926 the code u changed had some expected data format back from the service it called.
                      it used that data format in the code to make the visual part of the output

                      the new api (that url ) provides data in a different format.

                      as an example of the type of thing I am talking about,

                      1 has a spreadsheet with 4 columns, and 1 has a spreadsheet with 8 columns and none of the column names are the same.
                      the code expected to find 4 columns with specific names. they aren’t there

                      how do you reconcile that?

                      =====> but these apis return json data not excel spreadsheets, it is just an example of the work you need to do

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      D 1 Reply Last reply Reply Quote 0
                      • D Offline
                        Djninja926 @sdetweil
                        last edited by

                        @sdetweil how do I make it JSON format

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          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