I'm attempting to use the AmazonFresh recipe API, which lets you specify a number of ingredients and then redirect the user to a shopping list on Amazon: https://www.amazon.com/afx/ingredients/verify
The basic functionality works well. However, when I create a URL using the API, my tag= parameter is missing, despite passing it in the URL parameters like the API documentation states:
Optional URL Parameter for Amazon Associates: ?tag={your_associates_tag}
When I redirect the user to the resulting URL, the tag= parameter is missing. Which means I can't track or affiliate purchases :(
I've uploaded a simple example here: https://trinket.io/python3/7170bc788d -- I'd expect, based on the documentation, that the resulting URL output contain a tag= parameter.
Note that adding it manually doesn't help. Try going here, which I added the tag to manually and you'll see the cart, but the tag gets cleared.
I rather suspect I'm doing something very basic wrong, but I can't quite figure it out.
Any tips? Anyone using this successfully? It doesn't appear that the AmazonFresh recipe API is well known or supported, I haven't got anywhere despite trying several Amazon support channels.
This should be a comment but my reputation isn't high enough.
I didn't see where you were doing anything wrong. As a tip I'd add
print_roundtrip()to your code from https://stackoverflow.com/a/61803546 to see the redirects etc.I tried wrapping your associates tag in braces, in case they are literal, but it didn't help. I also tried injecting your associates tag in
data-auth-portal-redirect-urlwhere it has nonetag%3D&but it still got lost.What the documentation says and what https://www.amazon.com/afx/ingredients/verify does seem very different!
I did notice that the tag is getting lost on the post's redirect. I tried making the request without allowing redirects and sending it myself, adding back the tag. The tag is then in the returned
data-auth-portal-redirect-urland html but still not indata-encoded-recipe-url