News for hackers. Stuff that matters.

ignaciochiazzo

Re:Show HN: Ruby WhatsApp SDK Gem on Monday April 17, 2023 @01:23PM (#35603735)
Hey, thanks.

It should be easier to get started with Whatsapp Cloud API. I have been using the gem for a while and it's working for me.

Show HN: Ruby WhatsApp SDK Gem

https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk

Whatsapp Ruby SDK gemWhatsapp released the Cloud API. I had an App that uses Whatsapp, and I extracted all the Ruby code that talks to the API into a gem and made it public.The gem provides the ability to connect with Whatsapp API. Amongst them, you can:- Interact with Business Profiles. - Interact with Phone numbers. - Interact with Media: audio, videos, images, stickers, templates, and...

( Read More... | 2 comments | on HN )
Re:Paginating Requests in APIs (2020) on Wednesday June 01, 2022 @08:13AM (#31580701)
Hey, I'm the author of the post. Thanks for the feedback! I will update the article with some of the insights from here.

I wrote the post when I was investigating cursor-based pagination, which I had to implement at Shopify. We decided to use Cursor-based pagination since offset performance wasn't good enough. The larger the offset, the slower the query.

We decided to add the cursors to the LINK header page of each request response. The header contains two URLS: the previous and next page.

We saw a tremendous impact! In some cases, iterating over the pages sequentially using Cursor was much faster than sending parallel requests using Page-based pagination.

I built a library where you can compare the performance of Cursor vs Offset for a Shopify Store iterating on specific resources. This helped validate the approach at Shopify and prove to partners that it was worth migrating to Cursors!

More information here https://twitter.com/IgnacioChiazzo/status/153071174122657382...

Re:Paginating Requests in APIs (2020) on Tuesday May 31, 2022 @11:48PM (#31577833)
Sometimes the data is so big, and performance is critical that you don't have any other option than not to use offset.
Re:Paginating Requests in APIs (2020) on Tuesday May 31, 2022 @11:42PM (#31577792)
I strongly suggest not doing this since the application will be implementing `offset` in that scenario. This is the same as having Page-based pagination but with a cursor that acts a filter/sorting blob.
Re:Paginating Requests in APIs (2020) on Tuesday May 31, 2022 @11:40PM (#31577783)
Hey! Nice! I do think clients shouldn't store the cursor. This technique is neat, I will add it as an option to the Article (I’m the author).
Re:Paginating Requests in APIs (2020) on Tuesday May 31, 2022 @11:38PM (#31577777)
Hey thanks for the feedback. I will update the article.
Re:Paginating Requests in APIs (2020) on Tuesday May 31, 2022 @11:37PM (#31577772)
Query Limit +1 and then check the presence of the last item (Limit +1 item). Never use `count`. They are usually slow, and you might need to add more filters in the future. I will add this to the article.