YUN reading/getting REST values

Hi,

I have two YUN's and I would like them to communicate with each other via REST:

Here is the catch: I want the second YUN to GET/FETCH the value of the temperature sensor from the first YUN. I don NOT want the fist YUN to initiate the transaction, it MUST be initiated by the second YUN

I believe the coding of the first YUN is more or less standard as I followed the above mentioned example - Through a browser I can get/fetch the value of the Temperature sensor

My question relates to the programing of the second YUN and how to program it to get/fetch the data from the first YUN. How do I go about doing this ?

The best solution I can think of is using the Process.h library and execute curl command to get/fetch the data from the first YUN. Am I missing something ? Is there a better method of getting/fetching the data ?

Thanks
Gregg

This is what I have come up with:

#include <Bridge.h>
#include <Process.h>
#include <Console.h>

void setup() {
   Serial.begin(9600);
  
   // Bridge startup
   pinMode(13,OUTPUT);
   digitalWrite(13, LOW);
   Bridge.begin();
   digitalWrite(13, HIGH);
  
   Console.begin();
  
   while (!Console){
       ; // wait for Console port to connect.
   }
    
   Console.println("Console Connected"); Console.println("");
   digitalWrite(13, LOW);
 
}

void loop() {
   char result;
   String rest_temp;
   Console.println("Getting REST information...");
  
   Process temp;
   temp.runShellCommand("curl http://x.x.x.x/arduino/rest_test");
   while(temp.running());
   Console.print("Receiving data... ");
  
   while (temp.available()>0) {
      char result = temp.read();
      Console.print(result);
      rest_temp = rest_temp + result;
   }
  
   Console.println("");
   Console.print("Temperature via REST: ");
   Console.println(rest_temp);
  
   // Ensure the last bit of data is sent.
   Serial.flush();

   Console.println("DONE!!!");
   Console.println("");
  
   delay(2000);  
}

It works, but is it the best method ?