Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. tbe
    MagicMirror² v2.15.0 is available! For more information about this release, check out this topic.
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    tbe

    @tbe

    0
    Reputation
    402
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    tbe Follow

    Latest posts made by tbe

    • RE: JSON-RPC need help

      Thanks. But i have an other problem.
      The JSON request works per curl on console, but in js : "net::ERR_EMPTY_RESPONSE "

      Curl : 
      curl -i -X POST -H "Content-Type: application/json" -d "{\"jsonrpc\": \"2.0\", \"id\": \"0\", \"method\": \"GetValue\", \"params\": [18697]}" http://xxx.xxx.x.xx:3777/api/
      

      but in the MM-JS-Script don´t work. Looks like the json parameter don´t work.

      posted in Development
      T
      tbe
    • JSON-RPC need help

      i´m a beginner with javascipt and need help . how can i call the json-rpc function ( getData ) to get
      data from API and how can i parse it, to display the result an MM.
      the result of the call should be an JSON-RPC string .

      	getData : function(){
      	
      		var self = this;
      		var json = "http://xxx.xxx.xxx.xxx:3777/api/";		
      		var retry = true;
      
      
      	      var HTTP = new XMLHttpRequest();
      		    HTTP.open("POST",json,true);
      		    var rpc = JSON.stringify({"jsonrpc":"2.0", "method":"GetValue", "params":[18697], "id":0});
      		   HTTP.setRequestHeader("Content-type", "application/json");
      		   HTTP.send(rpc);
      		 
      	 },
      
      

      Thanks Thomas

      posted in Development
      T
      tbe