Webhook POST 201 response

Hi Blinkers

I’m trying to send values to Opensensemap.org using the Webhook widget on a local server in Docker container. Everything works fine, except that the Webhook stops after a short time sending the data.

According to the documentation valid HTTP response is only 200 or 302 and will stop sending after 10 times, but POST response from Opensensemap is 201 (“Measurements saved in box”)

Is there a way to configure the Blynk Webhook to accept 201 as valid response?

Thanks for your help

You could raise a GitHub request like in this topic:

Pete.

Hi Pete,
thank you for quick response. I’ve added the GitHub request as suggested. Hope it will be fixed soon. Do you know a workaround in between?

Thanks,
Harald

The list of valid response codes lives in this file in the server source code:

core/src/main/java/cc/blynk/server/core/processors/WebhookProcessor.java

    private static boolean isValidResponseCode(int responseCode) {
        switch (responseCode) {
            case 200:
            case 202:
            case 204:
            case 302:
                return true;
            default:
                return false;
        }
    }

If you can find that file on your local server installation (easier said than done with a dockerised setup, but should be possible) then you could probably edit it to add 201 to the list and restart the server.

If it all goes horribly wrong then don’t blame me! :crazy_face:

Pete.

2 Likes

Thanks Pete,
got it, but never worked with JAVA before. It seems I have to follow the learning curve… :slight_smile:

Me neither!

Pete.