GET request Webhook

Hi -

I created a GET Webhook to retrieve data from an endpoint provided by a client. The webhook seems to work as per the screen grab below:

I also entered some query parameters, so my question is whether this data will be parsed automatically based on the query parameters entered? If so, Is this done in the code section below?

void myHandler(const char *event, const char *data) {

    i++;
    //Serial.print(i);
    Serial.print("Data: ");
    Serial.println(event);
   
        if(data)
            Serial.print(data);
            else
            Serial.print(NULL);
}

Regards, Friedl.

1 Like

Checking if (data) only checks whether data is a non-zero pointer.
But even a non-zero pointer does not guarantee that there is any useful data.

You'd rather check if (strlen(data)) which checks whether there is a string with non-zero length.

1 Like

Hi @ScruffR -

damn... this coding thing is hard :exploding_head: :smile: I will make the change.

I am able to serial print the data from the end point data, it looks like this:

Data: hook-response/get_data/0
{"id":1,"readerId":21312,"readerMode":"ScanIn","roomName":"Grand Ballroom","events":[{"title":"Who Do You Think You Are?: Best Practices in Human Resources","startTime":"2025-10-14T12:55:00+00:00","endTime":"2025-10-14T13:45:00+00:00","instructorFirstName":"Toby","instructorLastName":"Flenderson"},{"title":"Keynote: Using Mnemonic Devices to Enhance Your Paper-Selling Skillset","startTime":"2025-10-14T14:00:00+00:00","endTime":"2025-10-14T16:00:00+00:00","instructorFirstName":"Michael","instructorLastName":Data: hook-response/get_data/1
"Scott"}]}

From here I need to put each of those parameters in a variable so I can display them on a epaper display.

This is a JSON response and as such you can either use the built-in JSON parsing features or Rick's brilliant JsonParserGeneratorRK library.

In case you won't need all the data from that response, you can already filter out the valuable data in the Webhook definition.

As it seems your response may also exceed the maximum chunk size for a single event and hence you'll need to first stitch all the response chunks together before being able to successfully parse it.

1 Like

Hi -

Thank you for the links, let me have a look. Pretty sure I will be back here asking more trivial questions, but will first try at least :grin:

Regards and many thanks! Friedl.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.