allegro / allegro-api

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

Status code of endpoint: https://api.{environment}/sale/product-offers/{offerId}/operations/{operationId} #9335

Open marcusskelly opened 1 week ago

marcusskelly commented 1 week ago

I am making calls to https://api.{environment}/sale/product-offers endpoint and I get a 202 status code. I then make calls to https://api.{environment}/sale/product-offers/{offerId}/operations/{operationId} with the offer_id and the operation_id returned from previous response and I get a 200 status code when I am supposed to get a 202 status code with this as body: { "offer": { "id": "123456789" }, "operation": { "id": "b572cdd0-7f2c-4800-9165-15795bd95f3c", "status": "IN_PROGRESS", "startedAt": "2019-05-29T12:00:00Z" } }

instead I get a 200 with a body similar to what I obtained in https://api.{environment}/sale/product-offers. The offers are listed correctly and all but I am just wondering why I get that status_code and body that is not in the documentation.

AureliuszBrussy commented 1 week ago

Status 202 is returned until the operation is completed. When it is completed, we return status 303 See Other with a new address in Location, exactly with the address pointing to /sale/product-offers/{offerId} endpoint.

The library you're using probably doesn't show you the 303 result, just redirects request immediately to the resource in location header, to retrieve the offer data for which we completed the operation.