allegro / allegro-api

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

Offer publication change status not working #4762

Closed aswiniimpro closed 2 years ago

aswiniimpro commented 3 years ago

Offer publication API is not working. When tried to change status for a offer using https://api.allegro.pl/sale/offer-publication-commands/52f147dd-3bdf-4e1f-b3d4-6f52fc49da57 Got Response as { "id": "52f147dd-3bdf-4e1f-b3d4-6f52fc49da57", "taskCount": { "total": 0, "success": 0, "failed": 0 } }

When check with https://api.allegro.pl/sale/offer-modification-commands/52f147dd-3bdf-4e1f-b3d4-6f52fc49da57/tasks, it gives as { "tasks": [ { "offer": { "id": "10805931270" }, "message": "", "status": "SUCCESS", "scheduledAt": "2021-07-28T06:21:53.07Z", "finishedAt": "2021-07-28T06:21:53.054Z", "field": "publication", "errors": [] } ] }

But, no changes updated even after an hour

Please help us to resolve this issue.

hahyes commented 3 years ago

Word of caution: this part of API is async. There is no guarantee that changes will happen instantly, you rather are adding task of changing status to their internal queue.

Lukasz-Zurek commented 3 years ago

@aswiniimpro You have already used this UUID previously to end your offer (yesterday, early in the morning) and it has been successful. The information which you have just received - contains a correct status.

Lukasz-Zurek commented 3 years ago

@aswiniimpro Please note the fact that UUID are single-use only.

aswiniimpro commented 3 years ago

Thanks.

We are not clear about allegro's "UUID are single-use only"

In our system our product's stock will be get changed frequently, it will go to 0 available stock, and in another few hours we will get stocked. In Allegro we can't update/create stock to 0. So to avoid sale for the items which has stock 0, we need to use this https://api.allegro.pl/sale/offer-publication-commands/command-Id API to change the status to "Ended" temporarily.

Once the stock is available from ourside, we update the quantity for that offer/product to "Active" status. Is this the correct method? Can we change the status for an offer frequently?

Lukasz-Zurek commented 3 years ago

Yes, this is a correct method. The process works fine. All I wanted to explain was the fact that UUID are single-use only. In commandId you have to provide the value in the UUID (universally unique identifier) format. You will find more information in our tutorial.

You should make every single change of the offer with the uniqe/other UUID. So you have to generate it every time you change the offer's status.

I suggest to implement the mechanism for generating UUIDs in your software.

aswiniimpro commented 3 years ago

Hi,

In sandbox, when create an offer with ACTIVE status, it is created in active in allegro sandbox dashboard.

But, I got response as INACTIVE for the offer. This is happening only in sandbox for create offer.

AureliuszBrussy commented 3 years ago

Can you explain this problem in more detail? Are you able to give a specific example?

aswiniimpro commented 3 years ago

Yeah sure,

Sent request is { "product":{ "id":"a60f4ebb-9c24-434c-b7d7-800b6fcae63d", "name":"xxx", "images":[ "xx" ] }, "publication":{ "status":"ACTIVE", "startingAt":null, "startedAt":null, "endingAt":null, "endedAt":null }, . . . . . }

Got Response as,

{ "id": "7680755197", "name": "016-1825-00 Xerox Phaser 850 Ink Cyan", "product": { "id": "a60f4ebb-9c24-434c-b7d7-800b6fcae63d", "publication": { "status": "LISTED" } }, "afterSalesServices": { "impliedWarranty": { "id": "xxx" }, "returnPolicy": { "id": "xxx" }, "warranty": null }, "payments": { "invoice": "VAT" }, "sellingMode": { "format": "BUY_NOW", "price": { "amount": xxx, "currency": "PLN" }, "startingPrice": null, "minimalPrice": null }, "stock": { "available": 1, "unit": "UNIT" }, "location": { "countryCode": "xxx", "province": xxx, "city": "xxx", "postCode": "xxx" }, "delivery": { "shippingRates": { "id": "xxx" }, "handlingTime": "PT24H", "additionalInfo": null }, "publication": { "duration": null, "status": "INACTIVE", "endedBy": null, "endingAt": null, "startingAt": null, "republish": false }, . . . . . }

Trace-id - e32b81250af9ccf9

But, in allegro sandbox dashboard, it shows as in ACTIVE status - https://nimb.ws/HtdIgx

So, it is confused to save response in our side.

AureliuszBrussy commented 3 years ago

I see you are using POST /sale/product-offers. First of all - you do not need to use PUT /sale/offer-publication-commands/{commandId} command to publish offers. You can activate the offer in one request, just by using POST /sale/product-offers.

Secondly: due to the longer time of some operations e.g. change of the offer publication status we have introduced the asynchronous API pattern for the /sale/product-offers resources. Please, check our guide on how does integration with an asynchronous API should work.

202 Accepted status response means that we will perform the task asynchronously due to the longer duration of the operation.

Along with the 202 Accepted status, we will return the Location header in which you will find a link to the new resource. Use the GET method on it to check the task status.

aswiniimpro commented 2 years ago

Hi,

We are having an allegro order with 2 different products. So, how to send track number for 2 different items in API.

Can we add multi track number for different items?

AureliuszBrussy commented 2 years ago

Could you elaborate? Unfortunately, I don't understand this problem.

aswiniimpro commented 2 years ago

https://api.allegro.pl/order/checkout-forms/{order-id}/shipments , In this shipment API, we are sending track number of an order. When an order have with 2 different items, how can we send 2 track number for those items.

Can we able to send 2 track numbers for 2 separate items in an order.

For Ex : xxxxx is an order with 2 items aaa, bbb. With this shipment API, https://api.allegro.pl/order/checkout-forms/xxxxx/shipments, Request: { "lineItems":[ { "id":"aaa" } ], "carrierId":"GLS", "carrierName":"GLS", "waybill":"AG000" }.

This is updating track number per order. Can we able to update different track for aaa, bbb?

AureliuszBrussy commented 2 years ago

@aswiniimpro by POST /order/checkout-forms/{id}/shipments you can add separate tracking numbers for each lineItem.id (single purchase events IDs) in the order. If you do not pass lineItem.id in your request, we will automatically assign a tracking number to each lineItem.id in your order. You can find sample request in our guide.

aswiniimpro commented 2 years ago

Hi @AureliuszBrussy ,

For Bulk price update by percentage i have used this endpoint.

PUT /sale/offer-price-change-commands/{command-id}

I got the response as

{ "id": "fc572cab-7597-4977-a2b0-32ce54c8e694", "taskCount": { "total": 0, "success": 0, "failed": 0 } }

To know the price update status of each offers i need to call another API call.

GET /sale/offer-price-change-commands/{commandId}

This gives the output like

{ "id": "fc572cab-7597-4977-a2b0-32ce54c8e694", "taskCount": { "total": 2, "success": 2, "failed": 0 } }

If suppose i have a failed records, any way to easily find out the failed offers list alone ?

I found another api to know the status of each offers price update status.

GET /sale/offer-price-change-commands/{commandId}/tasks

I got the response like

{ "tasks": [ { "offer": { "id": "xxxxxxxx" }, "message": "", "status": "SUCCESS", "scheduledAt": "2021-09-23T11:35:05.848Z", "finishedAt": "2021-09-23T11:35:05.829Z", "field": "price", "errors": [] }, { "offer": { "id": "yyyyyyy" }, "message": "", "status": "SUCCESS", "scheduledAt": "2021-09-23T11:35:05.848Z", "finishedAt": "2021-09-23T11:35:05.829Z", "field": "price", "errors": [] } ] }

We need to update price for 5k offers. This API call supports 1000 offers per request. So if i wish to get the failed records alone, how did i get this instead of checking response for each offers ?

We choose the bulk update price to save time than updating price for each offer. But to know the price change status we need to call another API. So this also takes time equal to individual offer price update API.

Please let us know to filter failed records from API response by status filter?

AureliuszBrussy commented 2 years ago

@aswiniimpro there is no way to filter only failed tasks on GET /sale/offer-price-change-commands/{commandId}/tasks (on Allegro API side). We do not provide such a query parameter - you can only get all tasks.

aswiniimpro commented 2 years ago

Hi @AureliuszBrussy ,

If i implement the API as php script, after bulk price update via PUT /sale/offer-price-change-commands/{command-id} ,

If i call GET /sale/offer-price-change-commands/{commandId}, I am getting response as,

{ "id": "2e08081e-2db5-4419-926a-2730a5d1d622", "taskCount": { "total": 1, "success": 0, "failed": 0 } }

But checked the same inside postman, getting response as

{ "id": "2e08081e-2db5-4419-926a-2730a5d1d622", "taskCount": { "total": 1, "success": 1 , "failed": 0 } }

GET /sale/offer-price-change-commands/{commandId} - This api call needs any time interval after bulk price update to fetch get the correct count ?

PrzemyslawLukanowski commented 2 years ago

Hello, yes, because this endpoint works asynchronously, so you will receive the correct count after the operation is completed (which can take up to one hour, but in most cases, it happens much faster).

aswiniimpro commented 2 years ago

Okay. So use of GET /sale/offer-price-change-commands/{commandId}/tasks this API to get the update status also will give incorrect results while calling immediately after bulk price update api ?

PrzemyslawLukanowski commented 2 years ago

It depends on whether the task is finished - if it is, you will receive the correct result.

aswiniimpro commented 2 years ago

Can we send offer price in euro currency and will allegro auto convert it into PLN currency ? Is there any option in API or seller portal ?

aswiniimpro commented 2 years ago

We have to update all offers price daily once after exchange rates have changed for Euro to PLN currency. So we have used bulk price update by percentage API to update prices.

If we get immediate results, then it will be easy for us to update the price change status for an offer. Otherwise, we need to call the offer price change status API and check all results again and again without knowing whether it is exact status or not.

How do we know whether the offer price update is in queue ? any specific status to know about it ?

Now we get 'Success' / 'Failure' as status.

PrzemyslawLukanowski commented 2 years ago

Unfortunately no, you should provide the price in PLN currency, because it won't be auto-converted and we will display the price as "zł".

You can still use GET /sale/offer-price-change-commands/{commandId}/tasks to check whether the task was finished successfully. If you will receive "SUCCESS" status, it means that the operation ended successfully and from now it can take up to one hour to change the price in the offer (but as I wrote, usually it happens much faster). If the price change operation is in the queue (so you don't know if it ends with success or not) we will return the "NEW" status in the response. To be sure that the price has now been updated in the offer, you can use GET /sale/offer or GET /sale/offer/{offerID} endpoint and check the sellingMode.price.amount field.

aswiniimpro commented 2 years ago

Okay thank you. So 'New' status indicates the action was not completed ?

PrzemyslawLukanowski commented 2 years ago

exactly

aswiniimpro commented 2 years ago

Okay thank you.

aswiniimpro commented 2 years ago

Hi @PrzemyslawLukanowski ,

We are getting this response for offer creation and all api calls.

{"errors":[{"code":"ConstraintViolationException.ValidSeller","message":"You don't have the required permissions to publish offer (sell blocked). Verify your account as a company.","details":"ConstraintViolationException.ValidSeller","path":"seller","userMessage":"Nie masz wymaganych uprawnień, aby wystawić ofertę (sprzedaż zablokowana). Zweryfikuj swoje konto jako firmowe."}]}

Till yestreday all api calls works fine. Please let us know the reason and how to solve this.

PrzemyslawLukanowski commented 2 years ago

I suspect that you are receiving this message in the Sandbox environment? If so, go to the Settlements with Allegro and using the payment simulator, click on the "PAY" button. After a short time, your account will be unblocked.

aswiniimpro commented 2 years ago

Hi,

"Clicking PAY button" - Did this make any payment from our bank account or just for unblocking purpose?

aswiniimpro commented 2 years ago

I suspect that you are receiving this message in the Sandbox environment? If so, go to the Settlements with Allegro and using the payment simulator, click on the "PAY" button. After a short time, your account will be unblocked.

yes, we got this for sandbox account.

PrzemyslawLukanowski commented 2 years ago

I'm sorry, I gave you the link to the production environment, here's for the Sandbox - https://allegro.pl.allegrosandbox.pl/moje-allegro/moje-konto/rachunki/rozliczenia-z-allegro. This is a payment simulator, so we won't charge any fees from your account.

aswiniimpro commented 2 years ago

okay, thank you.

aswiniimpro commented 2 years ago

I'm sorry, I gave you the link to the production environment, here's for the Sandbox - https://allegro.pl.allegrosandbox.pl/moje-allegro/moje-konto/rachunki/rozliczenia-z-allegro. This is a payment simulator, so we won't charge any fees from your account.

Sorry for asking again. https://nimb.ws/Q8SwmG - As we connect our real account, need confirmation that it won't be make any real payments from our account ?

PrzemyslawLukanowski commented 2 years ago

If you are in the Sandbox environment, you don't need to worry. You can choose also "szybki przelew" and in the next steps, you will see the mentioned payment simulator.

aswiniimpro commented 2 years ago

Hi @PrzemyslawLukanowski ,

We have faced weird thing in sandbox mode. I have created offers from my site using allegro api. offers are in active status in my database. But that offer deleted from allegro 'My Offers' entry.

As per our previous reference, we can't delete offers in allegro. We can 'END' via API, it will automatically deleted after particular days. My offer created on Oct 5. But its entry not available in allegro.

Is there any limitation in number of offer creation for same product ? For testing i have created multiple offers for the same product and change old offers to ended status. I face this problem recent days only.

Please let us know the reason and any changes have done in Allegro.

aswiniimpro commented 2 years ago

Hi @PrzemyslawLukanowski ,

I found 'Ended' Offers changed to 'Draft' mode in seller portal, and show with message 'Your offer will be deleted in x days' https://nimb.ws/2KXEzu.

I have end these offers few days ago. Please let us know the allegro offer auto delete work logic.

PrzemyslawLukanowski commented 2 years ago

Hi,

We have faced weird thing in sandbox mode. I have created offers from my site using allegro api. offers are in active status in my database. But that offer deleted from allegro 'My Offers' entry.

Do you have sample offer IDs? The reason may be the update of the categories and parameters on Sandbox which took place on October, 6th - as a result, we also removed all offers from Allegro Sandbox. There is no other limit for the offer connected with the same product.

I found 'Ended' Offers changed to 'Draft' mode in seller portal, and show with message 'Your offer will be deleted in x days' https://nimb.ws/2KXEzu.

Are you sure those offers were active before? I'm asking because the offer status cannot be changed from ENDED to DRAFT. Drafts are auto-deleted after 60 days - only if you edit something in it, we will extend its validity by 60 days.

aswiniimpro commented 2 years ago

Hi,

We have faced weird thing in sandbox mode. I have created offers from my site using allegro api. offers are in active status in my database. But that offer deleted from allegro 'My Offers' entry.

Do you have sample offer IDs? The reason may be the update of the categories and parameters on Sandbox which took place on October, 6th - as a result, we also removed all offers from Allegro Sandbox. There is no other limit for the offer connected with the same product.

Sample Offers: 7680843875 and 7680844146

I found 'Ended' Offers changed to 'Draft' mode in seller portal, and show with message 'Your offer will be deleted in x days' https://nimb.ws/2KXEzu.

Are you sure those offers were active before? I'm asking because the offer status cannot be changed from ENDED to DRAFT. Drafts are auto-deleted after 60 days - only if you edit something in it, we will extend its validity by 60 days.

We have ended some Offers. That offers changed to 'DRAFT' mode automatically. Is possible to change 'ENDED' to 'DRAFT' status automatically ?

PrzemyslawLukanowski commented 2 years ago

Those offers were removed due to the mentioned Allegro Sandbox categories and parameters update. It is not possible to change the status from ENDED to DRAFT and it also applies to the offers 7680843875 and 7680844146 - offers should no longer be available via the My offers Tab.

aswiniimpro commented 2 years ago

Those offers were removed due to the mentioned Allegro Sandbox categories and parameters update. It is not possible to change the status from ENDED to DRAFT and it also applies to the offers 7680843875 and 7680844146 - offers should no longer be available via the My offers Tab.

Okay. Thank you.

aswiniimpro commented 2 years ago

Hi @PrzemyslawLukanowski ,

I have a question regarding update categories and parameters in allegro. What would happen if we already have several active offers on live allegro, while changes done in API side ?

PrzemyslawLukanowski commented 2 years ago

It depends on the type of the change, but the offer status won't be changed - changes should affect the offer model, so if you retrieve offer data via GET /sale/offers/{offerID}, you should receive the data with changes induced (i.e. change of the category or parameter ID)

aswiniimpro commented 2 years ago

Exactly what i am asking is, if suppose i have created offer for "Toners" category, I have given values for Color and Manufacturer attributes, Color as 'Yellow' and Brand as 'Apple'. If suppose after your API changes, 'Yellow' color or 'Apple' brand removed for Toner Allegro category, what will happen for that active offer in live ?

So we need to check the offer data to know about changes using this api GET /sale/offers/{offerID} to update changes to existing offer on live ?

PrzemyslawLukanowski commented 2 years ago

I don't recall such type of change, rather the opposite - we add new values. But theoretically - in such scenario, you won't be able to update such offer, cause in the response you will receive information that the provided values don't exist.

You should use GET /sale/offers/{offerID} before making the changes via PUT /sale/offers/{offerID} if you want to be sure that you are editing the most recent offer data.

aswiniimpro commented 2 years ago

Hi,

We have updated offers price using

Hi @AureliuszBrussy ,

For Bulk price update by percentage i have used this endpoint.

PUT /sale/offer-price-change-commands/{command-id}

I got the response as

{ "id": "fc572cab-7597-4977-a2b0-32ce54c8e694", "taskCount": { "total": 0, "success": 0, "failed": 0 } }

To know the price update status of each offers i need to call another API call.

GET /sale/offer-price-change-commands/{commandId}

This gives the output like

{ "id": "fc572cab-7597-4977-a2b0-32ce54c8e694", "taskCount": { "total": 2, "success": 2, "failed": 0 } }

If suppose i have a failed records, any way to easily find out the failed offers list alone ?

I found another api to know the status of each offers price update status.

GET /sale/offer-price-change-commands/{commandId}/tasks

I got the response like

{ "tasks": [ { "offer": { "id": "xxxxxxxx" }, "message": "", "status": "SUCCESS", "scheduledAt": "2021-09-23T11:35:05.848Z", "finishedAt": "2021-09-23T11:35:05.829Z", "field": "price", "errors": [] }, { "offer": { "id": "yyyyyyy" }, "message": "", "status": "SUCCESS", "scheduledAt": "2021-09-23T11:35:05.848Z", "finishedAt": "2021-09-23T11:35:05.829Z", "field": "price", "errors": [] } ] }

We need to update price for 5k offers. This API call supports 1000 offers per request. So if i wish to get the failed records alone, how did i get this instead of checking response for each offers ?

We choose the bulk update price to save time than updating price for each offer. But to know the price change status we need to call another API. So this also takes time equal to individual offer price update API.

Hi, we have implemented the bulk price update by percentage to update price for an offer. At the same time, we have used

https://api.allegro.pl.allegrosandbox.pl/offers/{offerId}/change-price-commands/{comamnd-id} - this api to update individual offer price update if any changes in product price.

But for single offer price update api we got the response as

{"id":"2b6adae2-cd25-4eba-88a1-b393144698d2","input":{"buyNowPrice":{"amount":"100.26","currency":"PLN"}},"output":{"status":"VALIDATED_AND_RUNNING","errors":[]}}

aswiniimpro commented 2 years ago

HI @AureliuszBrussy / @PrzemyslawLukanowski ,

I got same response, while i change offer status from 'ENDED' to 'ACTIVE' and change price also for the same offer in next api call.

Status change reflected in seller portal immediately. But Price change not reflected. Getting response as

{"id":"97982838-6bbf-4834-a3db-4e415b56db85","input":{"buyNowPrice":{"amount":"324.75","currency":"PLN"}},"output":{"status":"VALIDATED_AND_RUNNING","errors":[]}}

If i get response as 'VALIDATED_AND_RUNNING' price update not reflected in allegro. I have waited nearly 1 hr also.

PrzemyslawLukanowski commented 2 years ago

Hi, In the offer 7680865780 the price is correct - 324,75zł. When it comes to the offer 7680865781 we changed the price to 100.26zł at 09:26:06, but only for one second, because at 09:26:07 we executed another command, which contain the change of the price to 105.80.

The execution of command can take up to 1 hour.

aswiniimpro commented 2 years ago

Okay. I will check it again.

aswiniimpro commented 2 years ago

Hi @PrzemyslawLukanowski ,

Any updation is going on in allegro sandbox ? I have placed one order using visa payment. But not getting payment details in order response. status of the order is 'BOUGHT'. Order id: b6656a71-2bfe-11ec-b9ee-3f49fbc245f7

Also, No orders found inside my 'orders' page also. - https://nimb.ws/f2oaDq. But i have placed many orders.

PrzemyslawLukanowski commented 2 years ago

Are you sure you are logged on the seller account and not the buyer who made these purchases?

aswiniimpro commented 2 years ago

Are you sure you are logged on the seller account and not the buyer who made these purchases?

I can see orders in seller account. Where do we check buyer orders inside buyer account ?