Forum

    • Register
    • Login
    • Search
    • Categories

    Calling JSON from your HISE instance - to make a simple versioning system....

    Documentation
    8
    20
    249
    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.
    • Lindon
      Lindon last edited by Lindon

      So I've been messing about with the Server calls, making them interact with my wooCommerce server on my web site, and it seems to be working OK.

      So late (in bed) last night it occurred to me that all the wooCommerce REST API is doing is sending me a piece of json (pretty complicated json as it turns out). I (and you) dont need a RESTful API to be implemented on our web sites, a simple static file that contains json should work fine...

      So I tried it this afternoon, yep works fine, so here's a (conceptual) example.

      If your server is called (lets say) https://davescoolpatreonsite.com

      All you need do is open up an ftp link and upload a json file to a subdirectory on your web site and you can call it (from HISE or from your browser):

      So:

      • make a json file something like this:
      {
        "Name": "MyCoolProduct",
        "MajorVersion": 1,
        "MinorVersion" : 0,
        "MaintenanceVersion" : 0
      }
      

      lets call it myCoolProductVersion.json

      • make a directory on your server (lets say) called productversions, and upload this json file.

      OK check its working from in your favourite browser by using the URL:

      https://davescoolpatreonsite.com/productversions/myCoolProductVersion.json

      this should return and show you your json file.

      If this works, next you need to call it from your HISE product, here's the code:

      Server.setBaseURL("https://davescoolpatreonsite.com");
      
      inline function onButton1Control(component, value)
      {
          if(value)
          {
            Server.callWithGET("productversions/myCoolProductVersion.json", "", function(status, response) {
            
              Console.print("heres back from the server:" + trace(response));
            
            });  
          }
      };
      
      Content.getComponent("Button1").setControlCallback(onButton1Control);
      
      

      press the button in the interface - wait a bit (these calls are asynchronous - they don't happen immediately but when they feel like it...) and you should see your HISE object appear...you should be able to work out what to do with it to obtain the data and check it against some internal consts of these numbers.....

      Now you only need update your static json file on your web site to tell your product when its up to date or not.

      Clearly you can actually send any data you like...presets, descriptions, jokes, free offers, sale notifications etc. etc.

      HISE Development for hire.
      www.channelrobot.com

      orange 1 Reply Last reply Reply Quote 4
      • Casey Kolb
        Casey Kolb last edited by

        Whoa! That seems so obvious, but I didn't realize that. I was probably overcomplicating it with the Woocommerce attributes.

        Casey Kolb
        Founder & CEO of Lunacy Audio
        Composer | Producer | Software Developer

        1 Reply Last reply Reply Quote 1
        • orange
          orange @Lindon last edited by orange

          @Lindon FYI, After clicking the link: https://davescoolpatreonsite.com/productversions/myCoolProductVersion.json

          Google Chrome gives: DNS_PROBE_FINISHED_NXDOMAIN warning in my system 🙂

          develop Branch / XCode 13.1
          macOS Monterey / M1 Max

          Lindon 1 Reply Last reply Reply Quote 0
          • Christoph Hart
            Christoph Hart last edited by

            At least it doesn't open a porn site like the last dummy URL from another user 🙂

            d.healey Lindon orange 3 Replies Last reply Reply Quote 2
            • d.healey
              d.healey @Christoph Hart last edited by

              @Christoph-Hart It can be arranged...

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 1
              • Lindon
                Lindon @Christoph Hart last edited by

                @Christoph-Hart said in Calling JSON from your HISE instance - to make a simple versioning system....:

                At least it doesn't open a porn site like the last dummy URL from another user 🙂

                LOL yeah that was so funny....

                HISE Development for hire.
                www.channelrobot.com

                1 Reply Last reply Reply Quote 0
                • Lindon
                  Lindon @orange last edited by

                  @orange as it should...

                  HISE Development for hire.
                  www.channelrobot.com

                  orange 1 Reply Last reply Reply Quote 0
                  • orange
                    orange @Christoph Hart last edited by

                    @Christoph-Hart said in Calling JSON from your HISE instance - to make a simple versioning system....:

                    At least it doesn't open a porn site like the last dummy URL from another user 🙂

                    That feature can be implemented, in case the user wants to use a warezed version of the plugin 😄

                    develop Branch / XCode 13.1
                    macOS Monterey / M1 Max

                    1 Reply Last reply Reply Quote 0
                    • orange
                      orange @Lindon last edited by

                      @Lindon said in Calling JSON from your HISE instance - to make a simple versioning system....:

                      @orange as it should...

                      So is this normal because of the json file?

                      develop Branch / XCode 13.1
                      macOS Monterey / M1 Max

                      d.healey 1 Reply Last reply Reply Quote 0
                      • d.healey
                        d.healey @orange last edited by

                        @orange said in Calling JSON from your HISE instance - to make a simple versioning system....:

                        @Lindon said in Calling JSON from your HISE instance - to make a simple versioning system....:

                        @orange as it should...

                        So is this normal because of the json file?

                        It's not a real website 😉

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        orange 1 Reply Last reply Reply Quote 0
                        • orange
                          orange @d.healey last edited by orange

                          @d-healey said in Calling JSON from your HISE instance - to make a simple versioning system....:

                          @orange said in Calling JSON from your HISE instance - to make a simple versioning system....:

                          @Lindon said in Calling JSON from your HISE instance - to make a simple versioning system....:

                          @orange as it should...

                          So is this normal because of the json file?

                          It's not a real website 😉

                          @Lindon said in Calling JSON from your HISE instance - to make a simple versioning system....:

                          OK check its working from in your favourite browser by using the URL:

                          https://davescoolpatreonsite.com/productversions/myCoolProductVersion.json

                          this should return and show you your json file.

                          I asked because of this 🙂

                          develop Branch / XCode 13.1
                          macOS Monterey / M1 Max

                          d.healey 1 Reply Last reply Reply Quote 0
                          • d.healey
                            d.healey @orange last edited by

                            @orange If Lindon's set up a website called davescoolpatreonsite I think I have to take legal action 😛

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            orange 1 Reply Last reply Reply Quote 1
                            • orange
                              orange @d.healey last edited by orange

                              @d-healey said in Calling JSON from your HISE instance - to make a simple versioning system....:

                              @orange If Lindon's set up a website called davescoolpatreonsite I think I have to take legal action 😛

                              😄

                              develop Branch / XCode 13.1
                              macOS Monterey / M1 Max

                              ulrik 1 Reply Last reply Reply Quote 0
                              • ulrik
                                ulrik @orange last edited by

                                @Lindon Thanks for your tip! 🙏

                                Hise Develop branch
                                MacOs 13, Xcode 14.0.1
                                http://musikboden.se

                                1 Reply Last reply Reply Quote 0
                                • S
                                  Steve Mohican last edited by

                                  @Lindon said in Calling JSON from your HISE instance - to make a simple versioning system....:

                                  {
                                  "Name": "MyCoolProduct",
                                  "MajorVersion": 1,
                                  "MinorVersion" : 0,
                                  "MaintenanceVersion" : 0
                                  }

                                  I am defining a local variable and Console.print like this:

                                  local version_check_identifier = trace(response);
                                  
                                  Console.print(version_check_identifier);
                                  

                                  In console I am seeing that exact text, it is ok.:

                                  {
                                     "Name": "MyCoolProduct",
                                     "MajorVersion": 1,
                                     "MinorVersion" : 0,
                                     "MaintenanceVersion" : 0
                                  }
                                  

                                  But how can we pull and check the MajorVersion, MinorVersion, MaintenanceVersion?

                                  d.healey 1 Reply Last reply Reply Quote 0
                                  • d.healey
                                    d.healey @Steve Mohican last edited by d.healey

                                    @Steve-Mohican

                                    Perhaps:
                                    local majV = response.MajorVersion
                                    local minV = response.MinorVersion
                                    etc...

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    S 1 Reply Last reply Reply Quote 1
                                    • S
                                      Steve Mohican @d.healey last edited by

                                      @d-healey Oh, now it works! Thank you so much! 🙂

                                      d.healey ustk 2 Replies Last reply Reply Quote 0
                                      • d.healey
                                        d.healey @Steve Mohican last edited by

                                        @Steve-Mohican Homework - https://www.w3schools.com/js/js_objects.asp 😛

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        1 Reply Last reply Reply Quote 1
                                        • ustk
                                          ustk @Steve Mohican last edited by

                                          @Steve-Mohican
                                          https://docs.hise.audio/scripting/scripting-in-hise/additions-in-hise.html#object-oriented-programming
                                          Sorry, Dave began 🤣

                                          I cannot help pressing F5 in the forum...
                                          Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

                                          1 Reply Last reply Reply Quote 1
                                          • S
                                            Steve Mohican last edited by

                                            I think I am trying to make advanced things but I need some basic knowledge at the same time 😄 Thanks guys, ok I got the message 😂 @d-healey @ustk

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            19
                                            Online

                                            977
                                            Users

                                            6.6k
                                            Topics

                                            60.6k
                                            Posts