user42930: I wold like to make me a REST API with string values and more string Keys. 
like: ~http://url.tld/foo/bar/xy to get "bar" and do more...
Can somebody tell me how to get the second word out of the URL? In this case "bar".
The tutorial show's how to use /arduino/digital/13/1 as to set pin 13 High.I would like to get a different syntax. 
Something like this: arduino/device1/switch/on
By now i searched quite long and tested different things as you can see below, but i can't get more than one word caught to trigger from the client object. 
is boils down to the question why my client object changes the payload.
this part:
void process(BridgeClient client) {
  String url0 = client.readString();
  Console.print("process url0: ");      // --> is "bar/xy"
  Console.println(url0);
  String command = client.readStringUntil('/');
  String url1 = client.readString();
  Console.print("process url1: ");
  Console.println(url1);               // --> is "" aka:empty!

i made a MWE to show what i already did:
// Libraries:
#include <Bridge.h>
#include <BridgeServer.h>
#include <BridgeClient.h>
#include <Console.h>

// Constants:
const bool on = HIGH;
const bool off = LOW;

// Objects:
BridgeServer server;

void setup() {
  pinMode(6, INPUT_PULLUP);
  Bridge.begin();
  server.begin();
  Console.begin();
  while (!Console);
  Console.println("setup done..");
}

void loop() {
  BridgeClient client = server.accept();
  if (client) {
    process(client);
    client.stop();
  }
}

void process(BridgeClient client) {
    String url0 = client.readString();
    Console.print("process url0: ");   // --> is "bar/xy"
    Console.println(url0);
    String command = client.readStringUntil('/');
    String url1 = client.readString();
    Console.print("process url1: ");
    Console.println(url1);             // --> is "" aka:empty!
  if (command == "device1") {
    device1(client);
  }
  if (command == "status") {
    Console.print("process: command == status  | command: ");
    Console.println(command);
    statusCommand(client);
  }
}

void device1(BridgeClient client) {
  String URL = client.readString();                              
  Console.println("URL:");
  Console.println(URL);                               // ---> is "on"
  String mode = client.readStringUntil('\r');
  Console.println("mode:");
  Console.println(mode);                            // ---> is ""
  String value = getStringPartByNr(URL, '/', 1);
  Console.println("value:");
  Console.println(value);                            // ---> is ""
  power(on);
  if ( URL == "on"){
    client.print(F("found /on"));
    power(on);
  }
  else if ( URL == "off"){
    client.print(F("found /off"));
    power(off);
  }
}

void power(bool on_off){
  bool checkpin = digitalRead(6);                          // machine state
  if (checkpin == LOW && on_off == HIGH) {        // means power is off and on is called
    digitalWrite(13, HIGH);
    Console.print(" checkpin == LOW && on_off == HIGH [1] ");
  }
  else if (checkpin == HIGH && on_off == LOW) { // means power is on and off is called
    digitalWrite(13, LOW);
    Console.print(" checkpin == HIGH && on_off == LOW [2] ");
  }
}

void statusCommand(BridgeClient client) {
}

// splitting a string and return the part nr index split by separator
String getStringPartByNr(String data, char separator, int index) {
    int stringData = 0;        //variable to count data part nr 
    String dataPart = "";      //variable to hold the return text
    for(int i = 0; i<data.length()-1; i++) { //Walk through the text one letter at a time
        if(data[i]==separator) { //Count the number of times separator character appears 
            stringData++;
        } else if(stringData==index) { //get the text when separator is the rignt one
            dataPart.concat(data[i]);
        } else if(stringData>index) { //return text and stop if the next separator appears 
            return dataPart;
            break; // - to save CPU-time
        }
    }
    return dataPart; //return text if this is the last part
}



user37622: You misunderstand the networking Client class concept. It is a stream like the Serial object. Bytes are stored in the Client object's buffer only until you read them.

42930: <p>I wold like to make me a REST API with string values and more string Keys. </p>

<p>like: ~<a href="http://url.tld/foo/bar/xy" rel="nofollow noreferrer">http://url.tld/foo/bar/xy</a> to get "bar" and do more...</p>

<p>Can somebody tell me how to get the second word out of the URL? In this case "bar".</p>

<p>The tutorial show's how to use /arduino/digital/13/1 as to set pin 13 High.I would like to get a different syntax. 
Something like this: arduino/device1/switch/on</p>

<p>By now i searched quite long and tested different things as you can see below, but i can't get more than one word caught to trigger from the client object. </p>

<p>is boils down to the question why my client object changes the payload.</p>

<p>this part:</p>

<pre><code>void process(BridgeClient client) {
  String url0 = client.readString();
  Console.print("process url0: ");      // --&gt; is "bar/xy"
  Console.println(url0);
  String command = client.readStringUntil('/');
  String url1 = client.readString();
  Console.print("process url1: ");
  Console.println(url1);               // --&gt; is "" aka:empty!
</code></pre>

<p>i made a MWE to show what i already did:</p>

<pre><code>// Libraries:
#include &lt;Bridge.h&gt;
#include &lt;BridgeServer.h&gt;
#include &lt;BridgeClient.h&gt;
#include &lt;Console.h&gt;

// Constants:
const bool on = HIGH;
const bool off = LOW;

// Objects:
BridgeServer server;

void setup() {
  pinMode(6, INPUT_PULLUP);
  Bridge.begin();
  server.begin();
  Console.begin();
  while (!Console);
  Console.println("setup done..");
}

void loop() {
  BridgeClient client = server.accept();
  if (client) {
    process(client);
    client.stop();
  }
}

void process(BridgeClient client) {
    String url0 = client.readString();
    Console.print("process url0: ");   // --&gt; is "bar/xy"
    Console.println(url0);
    String command = client.readStringUntil('/');
    String url1 = client.readString();
    Console.print("process url1: ");
    Console.println(url1);             // --&gt; is "" aka:empty!
  if (command == "device1") {
    device1(client);
  }
  if (command == "status") {
    Console.print("process: command == status  | command: ");
    Console.println(command);
    statusCommand(client);
  }
}

void device1(BridgeClient client) {
  String URL = client.readString();                              
  Console.println("URL:");
  Console.println(URL);                               // ---&gt; is "on"
  String mode = client.readStringUntil('\r');
  Console.println("mode:");
  Console.println(mode);                            // ---&gt; is ""
  String value = getStringPartByNr(URL, '/', 1);
  Console.println("value:");
  Console.println(value);                            // ---&gt; is ""
  power(on);
  if ( URL == "on"){
    client.print(F("found /on"));
    power(on);
  }
  else if ( URL == "off"){
    client.print(F("found /off"));
    power(off);
  }
}

void power(bool on_off){
  bool checkpin = digitalRead(6);                          // machine state
  if (checkpin == LOW &amp;&amp; on_off == HIGH) {        // means power is off and on is called
    digitalWrite(13, HIGH);
    Console.print(" checkpin == LOW &amp;&amp; on_off == HIGH [1] ");
  }
  else if (checkpin == HIGH &amp;&amp; on_off == LOW) { // means power is on and off is called
    digitalWrite(13, LOW);
    Console.print(" checkpin == HIGH &amp;&amp; on_off == LOW [2] ");
  }
}

void statusCommand(BridgeClient client) {
}

// splitting a string and return the part nr index split by separator
String getStringPartByNr(String data, char separator, int index) {
    int stringData = 0;        //variable to count data part nr 
    String dataPart = "";      //variable to hold the return text
    for(int i = 0; i&lt;data.length()-1; i++) { //Walk through the text one letter at a time
        if(data[i]==separator) { //Count the number of times separator character appears 
            stringData++;
        } else if(stringData==index) { //get the text when separator is the rignt one
            dataPart.concat(data[i]);
        } else if(stringData&gt;index) { //return text and stop if the next separator appears 
            return dataPart;
            break; // - to save CPU-time
        }
    }
    return dataPart; //return text if this is the last part
}
</code></pre>

<p><a href="https://i.stack.imgur.com/3cKIq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3cKIq.png" alt="enter image description here"></a></p>
 37622: <p>You misunderstand the <a href="https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Client.h" rel="nofollow noreferrer">networking Client class</a> concept. It is a <a href="https://www.arduino.cc/reference/en/language/functions/communication/stream/" rel="nofollow noreferrer">stream</a> like the Serial object. Bytes are stored in the Client object's buffer only until you read them.</p>
