Behaviour of searching discount codes via admin API

swapnilbanga
New Member
4 0 0

So I have been trying to use 

/admin/api/2020-10/discount_codes/lookup.json?code=SUMMERSALE10OFF

To search for discount codes. It returns a 303 response with a link to the discount code. If I turn on "automatically follow redirects", I get an HTML response asking for authorization. I am not sure what's happening there, but I am guessing auth headers are not passed on to the redirect.
I have tried making this request both through postman and server (axios)
So a possible workaround is to not automatically follow redirect and try to parse the href and make a second request. Is there any better way?

0 Likes