Live data from Hacker News

Reversing Safeway's private APIs to automate coupon collection

blog.jonlu.ca

1–10 of 148 posts

Re: Reversing Safeway's private APIs to automate coupon collection

#2
This is the kind of stuff where I tell people that coding can be a real practical skill (that gives you an unfair advantage these days).

I did something similar (read-only) for Home Depot Truck Rentals. To check if the truck was available at my local store, each time, you had to put in your zip code, and click a couple of times. Once I found that was an API, I rebuilt the call in Postman and kept hitting that endpoint until a truck was available.

That way I could check really fast.

The twist: None of it mattered because their data itself didn't update accurately (I saw one in the parking lot and they had one available and never updated their site). :)

Re: Reversing Safeway's private APIs to automate coupon collection

#3
post #2

This is the kind of stuff where I tell people that coding can be a real practical skill (that gives you an unfair advantage these days). I did something similar (read-only) for Home Depot Truck Rentals. To check if the truck was available at my local store, each time, you had to put in your zip code, and click a couple of times. Once I found that was an API, I rebuilt the call in Postman and kept hitting that endpoin…

That is so true. Even if your algorithm works it's a human factor that breaks it.

Re: Reversing Safeway's private APIs to automate coupon collection

#5
post #3
post #2

This is the kind of stuff where I tell people that coding can be a real practical skill (that gives you an unfair advantage these days). I did something similar (read-only) for Home Depot Truck Rentals. To check if the truck was available at my local store, each time, you had to put in your zip code, and click a couple of times. Once I found that was an API, I rebuilt the call in Postman and kept hitting that endpoin…

That is so true. Even if your algorithm works it's a human factor that breaks it.

[deleted]

Re: Reversing Safeway's private APIs to automate coupon collection

#6
post #2

This is the kind of stuff where I tell people that coding can be a real practical skill (that gives you an unfair advantage these days). I did something similar (read-only) for Home Depot Truck Rentals. To check if the truck was available at my local store, each time, you had to put in your zip code, and click a couple of times. Once I found that was an API, I rebuilt the call in Postman and kept hitting that endpoin…

Exactly this.

I did the same thing to find available camping spots in Hawaii because they are super difficult to get. Wrote a script that would query their "API" every 5 minutes and alert me if a spot became available anywhere.

Re: Reversing Safeway's private APIs to automate coupon collection

#8
post #3
post #2

This is the kind of stuff where I tell people that coding can be a real practical skill (that gives you an unfair advantage these days). I did something similar (read-only) for Home Depot Truck Rentals. To check if the truck was available at my local store, each time, you had to put in your zip code, and click a couple of times. Once I found that was an API, I rebuilt the call in Postman and kept hitting that endpoin…

That is so true. Even if your algorithm works it's a human factor that breaks it.

Never underestimate the error introduced by a lack of incentive for humans to comply with the API (or the API itself being human-hostile).

My favorite example is the Domino's "Your pizza is ready" signal. Since the data feeding the signal also feeds the store's performance analysis (i.e. they track how fast employees are getting pizzas ready), there's significant incentive for employees to lie to the algorithm and hit "It's ready" before it's physically ready, on the assumption that customers will take nonzero time to wander over and show up for pickup.

Re: Reversing Safeway's private APIs to automate coupon collection

#9
Haha, I did something similar a while ago - I just invoked a click() on every "add coupon" button on their website, I didn't want to reverse engineer their APIs - way easier but also it requires a desktop browser with the page open.

I'm not sure if using this API is any different but a few months ago Safeway made a change that only lets you have 20(?) coupons at any time. After you add more it kicks off your oldest one. Which sounds like plenty but if you're adding every single coupon you're gonna get a ton that you have no desire for ($1 off diapers when you don't have a kid etc).

It worked for a while, though!

Post reply on HN