Possible bug? Booking update webhook json data incorrect?

Hello!

While working with webhooks I think I might have encountered a bug:

I have implemented a webhook receiver in my site, and I have been testing it with the sample data provided in the docs here: http://api.checkfront.com/ref/webhook/booking.html# ;

If I send via POST (using postman or insomnia for example) the json payload indicated there, it's received correctly by my site.

However, when it's sent by the real API, it looks like it's not proper json. 

In this screenshot you can see what I get if I just print out the value I get in the request. On the left the test data sent via postman, on the right the real webhook I get from the API:



It looks to me the json I am getting for this particular webhook is not formatted correctly. Could you confirm that it's working as expected on your end? 

thanks!

Mario.




Comments

  • (this is really important for us to update availability when a booking is made)
  • Hi @vermario,

    Thank you for reaching out!

    I have just done a test using both the booking status change webhook, as well as the booking modified webhook, and both seem to be returning the correct JSON, as specified here: http://api.checkfront.com/ref/webhook/booking.html#json. I can certainly see from your screenshot that whatever you are receiving is invalid JSON, however I can't seem to reproduce that output using RequestBin to receive the webhook. This indicates that the issue might be with the way that you are parsing the JSON - perhaps you are not correctly parsing the @ symbol?

    I hope this helps, but let me know if you have any additional questions, and as always feel free to reach us at support@checkfront.com.

    Best Regards,
    Brett- Checkfront Support Team
  • Hello @Brett ,

    after some more debugging, I was able to find out the problem on my end: the json is indeed valid, what was tripping me up was that my test data had 2 products in the booking, while the real booking I was testing with only had 1 product.

    the "items->item" property will contain an array of objects if there are more than one element, or it will be inserted directly as an object in the json structure if there is only one. The code that I was using to parse it did not take this into account, so it was failing. 

    thanks!

Sign In or Register to comment.