Now registered function methods in the code return String instead of int. For instance, it would allow the responses to be more complex, now it can be returned a response containing String, int casted to String or even a JSON or XML. Therefore, it lets you reply with more than one simple integer.
Now registered function methods in the code return String instead of int. For instance, it would allow the responses to be more complex, now it can be returned a response containing String, int casted to String or even a JSON or XML. Therefore, it lets you reply with more than one simple integer.
E.g:
void setup() {
.
.
.
rest.function("test", testFunction);
}
String testFunction(String params) {
String strJson= "{\"key1\" : \"value1\", \"key2\" : \"value2\"}";
return strJson;
}
I did a test with the following result: