allegro / allegro-api

Issue tracker and wiki for Allegro REST API
https://developer.allegro.pl/
210 stars 39 forks source link

Django integration #9292

Open marcusskelly opened 2 weeks ago

marcusskelly commented 2 weeks ago

I am doing an integration with Allegro. I have two Sandbox accounts: Seller and Buyer. In order to make calls to the seller account I get an access_token. I get this token through Authorization Code flow. This token works when I make calls through postman and Python scripts but somehow it does not work when I make calls to an endpoint in my django app. It gives me a 403 status code. I believe this has soemthing to do with the device. I do the whole flow through my Django app and still gives me 403...

PrzemyslawLukanowski commented 2 weeks ago

Please send me a sample trace-id connected with the operation for which we returned a 403 error code. I will see how it looks on our side.

marcusskelly commented 2 weeks ago

This is the response I get:

this is response.text

allegrosandbox.pl

Please enable JS and disable any ad blocker

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://allegro.pl.allegrosandbox.pl/sale/product-offers/7769461313 [27/Jun/2024 10:23:04]

this is response.headers:

{'content-type': 'text/html, text/html; charset=utf-8', 'content-length': '587', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=15552000', 'set-cookie': '_cmuid=9a943cf2-c72b-487e-b44c-7d80d7a300f6; Expires=Fri, 01 Aug 2025 08:27:18 GMT; Path=/; Domain=.allegro.pl.allegrosandbox.pl; Secure, datadome=4dl3u28FTm3JfWTTh2jzX3nmvJTPqDk9ZKyfxZQdSj2QXTd2TwtyQbF8I2q6NfBuZeL8t5ZCov2z8VzI7aclaQCGEKxgrGY8qJHHctQPdzG61QQt0Wnjnq9nvqmh89; Max-Age=31536000; Domain=.allegrosandbox.pl; Path=/; Secure; SameSite=Lax', 'accept-ch': 'Sec-CH-UA,Sec-CH-UA-Mobile,Sec-CH-UA-Platform,Sec-CH-UA-Arch,Sec-CH-UA-Full-Version-List,Sec-CH-UA-Model,Sec-CH-Device-Memory', 'charset': 'utf-8', 'cache-control': 'max-age=0, private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'access-control-allow-credentials': 'true', 'access-control-expose-headers': 'x-dd-b, x-set-cookie', 'access-control-allow-origin': '*', 'x-datadome-cid': 'AHrlqAAAAAMA5_1Tv-xq2rMAAoujog==', 'x-dd-b': '2', 'x-robots-tag': 'noindex'}

PrzemyslawLukanowski commented 2 weeks ago

You are using the wrong endpoint address, instead of https://allegro.pl.allegrosandbox.pl/sale/product-offers/7769461313 please use https://api.allegro.pl.allegrosandbox.pl/sale/product-offers/7769461313

marcusskelly commented 2 weeks ago

Great! It worked! Thx :)

marcusskelly commented 1 week ago

By the way. I am trying to update stock and price of the offers I have in the catalog. I am using this one:

https://api.{environment}/sale/product-offers/{offerId}

I understand there are two more that update price and quantity:

https://api.{environment}/sale/offer-price-change-commands/{commandId}

https://api.{environment}/sale/offer-quantity-change-commands/{commandId}

The problem with these last two is that I cant set different prices to different offers. Its sets the same price and quantity to all the offers passed on 'offers' list. I have no option but using https://api.{environment}/sale/product-offers/{offerId} in a for loop for all my offers then.

PrzemyslawLukanowski commented 1 week ago

Yes, you're right, that's how it works.

stale[bot] commented 5 days ago

W tym wątku nie pojawiła się żadna nowa odpowiedź w ciągu 7 dni, dlatego automatycznie oznaczamy go jako przeterminowany. Jeśli w ciągu kolejnych 7 dni nie pojawi się żadna odpowiedź, wątek zostanie zamknięty. Dziękujemy za zaangażowanie w dyskusję i zachęcamy Cię do wypełnienia ankiety dotyczącej naszego wsparcia na forum.


There was no new reply in this thread within 7 days, therefore, we automatically marked it as expired. If no response is received within the next 7 days, this thread will be closed. Thank you for engaging in the discussion. We encourage you to complete our forum support survey.