allegro / allegro-api

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

Access denied for sale/product-proposals in sandbox #6017

Closed din1s closed 1 year ago

din1s commented 2 years ago

Hello!

I'm trying to add a product to the test environment, an error is returned "Access denied". I created an authorization token without specifying a scope, It looks like the problem is with account activation. I found a similar thread (https://github.com/allegro/allegro-api/issues/5126) Can you activate our account? Client ID 105468968

PrzemyslawLukanowski commented 2 years ago

Hi, to list offers via API you need a company account (yours is regular). Please change the type via this tab.

din1s commented 2 years ago

Thanks for the answer! Account type was changed, but the error remains

PrzemyslawLukanowski commented 2 years ago

Please continue full activation process for selling via this tab. If error still remains after you finish this, please let me know.

din1s commented 2 years ago

Everything was filled in, the Access denied error remained

PrzemyslawLukanowski commented 2 years ago

Ok, I've ended the activation process on our side, and now everything should work.

din1s commented 2 years ago

Thank you very much, everything worked!

There was one more question. We are adding books, we cannot associate our publishers with the publishers on your system, so we decided to pass the value for the parameter (ID 223541) 223541_305725 (inne). But when adding a product, an error is returned "Nie została podana propozycja wartości do wartości niejednoznacznej w parametrze Wydawnictwo".

How can we be in such a situation and what to transmit as a publisher?

PrzemyslawLukanowski commented 2 years ago

In this case, provide your value in the "values" field. Here you can find sample:

{
     "id": "23541",                             -- parameter id
     "valuesIds": [
       "23541_305725"                           -- ambiguous value id
     ],
     "values": [ "{Missing publisher value}" ],    -- value, which you want to provide.
                                                 Complete this field.
     "rangeValue": null
}
din1s commented 2 years ago

We want to add more than 100k positions of books in Russian to the catalog, so that it would be easier for customers to search for the books they need, you can create subcategories for yourself as in books in English https://prnt.sc/oabNnVUx2EW_, and we will connect our own with them and load like this?

PrzemyslawLukanowski commented 2 years ago

Adding subcategories in an existing category is not a topic directly connected with Allegro API, so please use our contact form in this case.

din1s commented 2 years ago

Hello! We are trying to add one trade offer to the working environment and the following error occurs:

[code] => ConstraintViolationException.MissingRequiredParameters [message] => Missing required parameters: 248247, 249493 [details] => ConstraintViolationException.MissingRequiredParameters [path] => parameters [userMessage] => Uzupełnij parametry obowiązkowe: Rodzaj, Gatunek.

The same product was added to the test environment without problems. With what it can be connected? An example of our request:

{"productSet":[{"product":{"name":"Skazy","category":{"id":"91465"},"id":"a53b7203-d34b-4947-855f-a8ed183e9d91"},"quantity":{"value":1}}],"delivery":{"handlingTime":"PT0S","shippingRates":{"id":"401eb0ba-b9ea-4aa0-a4f2-bd92c684c558","name":"dost"},"additionalInfo":"","shipmentDate":"2022-08-26T00:00:00Z"},"category":{"id":"91465"},"payments":{"invoice":"VAT"},"parametrs":[{"id":248247,"valuesIds":["248247_883389"]},{"id":249493,"valuesIds":["249493_1645911"]}],"afterSalesServices":{"warranty":{"id":"bf074d0f-1c39-43a9-b3d7-fa4b77b3e809","name":"default1"},"returnPolicy":{"id":"bf074d0f-1c39-43a9-b3d7-fa4b77b3e809","name":"default1"},"impliedWarranty":{"id":"bf074d0f-1c39-43a9-b3d7-fa4b77b3e809","name":"default1"}},"sellingMode":{"format":"BUY_NOW","price":{"amount":"97","currency":"PLN"},"minimalPrice":{"amount":"97","currency":"PLN"},"startingPrice":{"amount":"97","currency":"PLN"}},"stock":{"available":"1","unit":"UNIT"}}

PrzemyslawLukanowski commented 2 years ago

Could you please try to add those parameters in the productSet.product.parameters section? Like in the second example at the beginning of our tutorial:

curl -X POST
  'https://api.allegro.pl/sale/product-offers'
  -H 'Authorization: Bearer {token}'
  -H 'Accept: application/vnd.allegro.public.v1+json'
  -H 'Content-Type: application/vnd.allegro.public.v1+json'
  -d '{
    "productSet": [{
        "product": {
            "id": "d26b023c-d52c-44f9-b61a-321eb202792b",
            "parameters": [{
                "id": "202293",
                "valuesIds": [
                    "202293_211441"
                ]
            }]
        }
    }],
    "sellingMode": {
        "price": {
            "amount": "220.85",
            "currency": "PLN"
        }
    },
    "stock": {
        "available": 1
    }
}'

There may be some discrepancies between our production and test environment. Once a quarter we update a list of categories and parameters to ensure consistency between these.

din1s commented 2 years ago

Thanks for the answer! Didn't work, still got error. The request was like this:

{
  "productSet": [
    {
      "product": {
        "name": "Skazy",
        "category": {
          "id": "91465"
        },
        "id": "a53b7203-d34b-4947-855f-a8ed183e9d91",
        "parametrs": [
          {
            "id": 248247,
            "valuesIds": [
              "248247_883389"
            ]
          },
          {
            "id": 249493,
            "valuesIds": [
              "249493_1645911"
            ]
          }
        ]
      },
      "quantity": {
        "value": 1
      }
    }
  ],
  "delivery": {
    "handlingTime": "PT0S",
    "shippingRates": {
      "id": "401eb0ba-b9ea-4aa0-a4f2-bd92c684c558",
      "name": "dost"
    },
    "additionalInfo": "",
    "shipmentDate": "2022-08-26T00:00:00Z"
  },
  "category": {
    "id": "91465"
  },
  "payments": {
    "invoice": "VAT"
  },
  "afterSalesServices": {
    "warranty": {
      "id": "bf074d0f-1c39-43a9-b3d7-fa4b77b3e809",
      "name": "default1"
    },
    "returnPolicy": {
      "id": "707b4c76-a4c7-499b-b5e1-1f8f629edcc3",
      "name": "1"
    },
    "impliedWarranty": {
      "id": "cb99c925-dfa0-4731-9e65-581819181001",
      "name": "1"
    }
  },
  "sellingMode": {
    "format": "BUY_NOW",
    "price": {
      "amount": "97",
      "currency": "PLN"
    },
    "minimalPrice": {
      "amount": "97",
      "currency": "PLN"
    },
    "startingPrice": {
      "amount": "97",
      "currency": "PLN"
    }
  },
  "stock": {
    "available": "1",
    "unit": "UNIT"
  }
}
PrzemyslawLukanowski commented 2 years ago

You have a typo in your data - "parametrs" instead of "parameters".

din1s commented 2 years ago

Thank you, the product has been added. But now the next problem is adding the product to the category https://allegro.pl/kategoria/po-angielsku-pozostale-91485

The error "Nie została podana propozycja wartości do wartości niejednoznacznej w parametrze Okładka" is returned.

We pass all the parameters, the request is as follows:

{
  "name": "16 urokov angliyskogo yazyka. Nachalnyy kurs",
  "description": {
    "sections": [
      {
        "items": [
          {
            "type": "TEXT",
            "content": "Dannoe izdanie predstavlyaet soboy nachalnyy kurs angliyskogo yazyka, razrabotannyy Dmitriem Petrovym. V pechatnoy versii kursa dany uprazhneniya, osnovnye pravila proiznosheniya i svedeniya o glagolah. S pomoschyu shestnadcati urokov po metodike Dmitriya Petrova vy smozhete osvoit bazovye algoritmy yazyka, primenit ih na praktike i dovesti do avtomatizma. V pomosch tem, kto zanimaetsya samostoyatelno, predlagaetsya polnyy sbornik klyuchey, t.e. vypolnennyh uprazhneniy. Teper chitateli smogut proverit, pravilno li oni usvoili grammaticheskie pravila, i vnesti neobhodimye korrektivy v process izucheniya yazyka.Nachnite govorit na angliyskom pryamo seychas!</p>"
          }
        ]
      }
    ]
  },
  "category": {
    "id": 91485
  },
  "images": [
    {
      "url": "https://a.allegroimg.com/original/11496a/8502517b4e87a1d133ac173f08aa"
    }
  ],
  "parameters": [
    {
      "id": 11323,
      "valuesIds": [
        "11323_1"
      ]
    },
    {
      "id": 245669,
      "values": [
        "9785041133856"
      ]
    },
    {
      "id": 248247,
      "valuesIds": [
        "248247_883389"
      ]
    },
    {
      "id": 249493,
      "valuesIds": [
        "249493_1645911"
      ]
    },
    {
      "id": 2868,
      "valuesIds": [
        "2868_5"
      ]
    },
    {
      "id": 75,
      "valuesIds": [
        "75_314838"
      ]
    },
    {
      "id": 74,
      "values": [
        "2020"
      ]
    },
    {
      "id": 223545,
      "values": [
        "16 urokov angliyskogo yazyka. Nachalnyy kurs"
      ]
    },
    {
      "id": 223489,
      "values": [
        "Petrov Dmitriy Yurevich"
      ]
    },
    {
      "id": 223541,
      "valuesIds": [
        "223541_305725"
      ],
      "values": [
        "Eksmo"
      ]
    }
  ]
}
PrzemyslawLukanowski commented 2 years ago

In the parameter with id 75 you have selected an ambiguous value. In this case, you should provide your own value in the "values" field, like below:

{
   "id": "75",                     
   "valuesIds": [
     "75_314838"                     
   ],
   "values": ["your value"],   
   "rangeValue": null
}

But to be honest, in my opinion, there's no need to choose an ambiguous value. I think we return all types of "covers" in the list of available values and you can choose a proper one.

din1s commented 2 years ago

Good afternoon! We sent a request from the contact form to the ID for authorization through DCR, more than a week has passed, but there was no answer. Is there any way to speed up this process?

PrzemyslawLukanowski commented 2 years ago

Hi, we've just received such a request from client ID e6f4557c742e4891815be964ae3***** - is it you? If so, you will receive more details via email.

din1s commented 2 years ago

Our client ID 3f3f856f695244d5ad810***

PrzemyslawLukanowski commented 2 years ago

We haven't received such a request yet. Could you please use the contact form once again and this time add information that the request should be forwarded to the API Team?

din1s commented 2 years ago

Good afternoon! Are there any restrictions on the loading of goods by api (per hour / per day / per week)? We downloaded about 80k products and now the speed has decreased.

PrzemyslawLukanowski commented 2 years ago

The main limit imposed on Client ID is one- 9000 requests per minute. But for selected REST API resources (like, for example GET /sale/products) we have a mechanism that limits the number of requests submitted by a given user. We use the Leaky Bucket algorithm. If you exceed the number of requests per minute (RPM), the response time is extended. This limit is not a constant value, so we cannot reveal information about it.

din1s commented 2 years ago

Good afternoon!

Can you please tell me if we can disable the offer and remove it? For some reason, at https://api.{environment}/sale/product-offers/{offerId} we can only assign the status ACTIVE and ENDED, the status INACTIVE does not apply. Tell me, what is the reason?

PrzemyslawLukanowski commented 2 years ago

INACTIVE status is equivalent to offer draft, so once you activate such an offer, you can only change the status to ENDED. Offer in ENDED status can be activated, but if you don't do that within 60 days after the offer ended, we will archive it, and it won't be possible to do anything with such an offer. Via /sale/product-offers you can also create offer drafts instead of listing active offers - in your request JSON just add publication.status field, like here.

din1s commented 2 years ago

Do we understand correctly that offers with ENDED status are automatically deleted after 60 days?

Can we speed it up somehow? We have added some suggestions that we want to remove now. Is this possible with the API?

PrzemyslawLukanowski commented 2 years ago

Do we understand correctly that offers with ENDED status are automatically deleted after 60 days?

Yes, if you don't activate them within 60 days from the last ENDED status, they will be removed (moved to our archive).

Can we speed it up somehow? We have added some suggestions that we want to remove now. Is this possible with the API?

Unfortunately no, only INACTIVE offers can be deleted immediately.

din1s commented 2 years ago

Hello! Can you please tell me if the token renewal works for sandbox?

We are trying to implement the extension of the token according to the example (https://developer.allegro.pl/tutorials/uwierzytelnianie-i-autoryzacja-zlq9e75GdIR#php), but when we try we get an error:

{"error":"invalid_client","error_description":"Unauthorized grant type: authorization_code"}

PrzemyslawLukanowski commented 2 years ago

Yes, refresh tokens work on Sandbox. The link you sent relates to the authorization code flow type of authorization (how to generate access and refresh tokens), not to extending token validity with refresh tokens directly. Please make sure that you changed all of the links to https://allegro.pl.allegrosandbox.pl/auth/oauth/authorize and https://allegro.pl.allegrosandbox.pl/auth/oauth/token.

din1s commented 2 years ago

Good afternoon! Found an issue where some trade offers are not created due to the error "The maximum allowed length of the offer title has been exceeded (50 characters, assuming that some letters and symbols are counted as more than 1 character).". But the problem is that the names are less than 50 characters, for example: "Chevrolet Niva. Vypusk s 2002, restay", "Art terapiya. Dzhungli Amazonki. 70 risunk", "Nauchno obrazovatelnaya sessiya k 85 letiyu", etc.

PrzemyslawLukanowski commented 2 years ago

Hi, we're verifying this issue. I'll let you know when we have more details.

din1s commented 2 years ago

Good afternoon! Any news on our issue?

PrzemyslawLukanowski commented 2 years ago

Unfortunately no, the problem is more complex and seems to be connected with the product names, not the offer titles you provide. Our team is still investigating it.

din1s commented 2 years ago

Good afternoon. Since yesterday, our API production authorization has stopped working. We cannot get a response to the token request for an infinitely long time. What information do you need?

PrzemyslawLukanowski commented 2 years ago

Hello, please send us sample requests via the contact form. Also, add information that the data refers to GitHub #6017 thread and include the token your trying to use. Are you getting any errors or no response at all?

din1s commented 2 years ago

Sent. We receive nothing in response, the request is sent, but no response follows

din1s commented 2 years ago

The request was sent through the form, all the data was indicated. Can you please tell us if you received our request?

PrzemyslawLukanowski commented 2 years ago

We still waiting for the data from the form, it needs to be passed to our department. In the meantime, I've checked our logs - it seems that your application sends us a lot of requests, but with an invalid device code. Could you please check this issue on your side - is this parameter and its value being sent correctly?

din1s commented 2 years ago

We have sent an application.

Yes, now sending with the correct code, we have changed the app data for another account

PrzemyslawLukanowski commented 2 years ago

We are still receiving requests with invalid device codes, for instance - you're trying to use "QOQQunJ8Z7Q8XfuBJtvZKY2NU4vTH***" since yesterday multiple times per minute.

din1s commented 2 years ago

We have now stopped everything, are the requests still coming?

PrzemyslawLukanowski commented 2 years ago

No, the last requests were at 14:21.

din1s commented 2 years ago

Good afternoon. About the length of news headlines? When adding products, we also encountered a problem, we get an error - You cannot create new drafts - your account has exceeded the maximum number 20000 of drafts.

Where can I find these drafts and how can I delete them?

PrzemyslawLukanowski commented 2 years ago

Hello, when it comes to the length of product names - our team is still working on it.

You can retrieve drafts by using GET /sale/offers?publication.status=INACTIVE and to delete them use DELETE /sale/offers/{offerID}.

din1s commented 2 years ago

Good afternoon. Sorry to bother you, can I find out the approximate time to resolve the issue by the titles of the goods?

PrzemyslawLukanowski commented 2 years ago

The problem should be fixed within the next two weeks.

stale[bot] commented 2 years 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.

din1s commented 2 years ago

Hello! Any news on our issue?

AureliuszBrussy commented 2 years ago

@din1s not yet, we will let you know as soon as the problem is solved. I apologize for the inconvenience.

PrzemyslawLukanowski commented 1 year ago

@din1s The problem has been solved. Sorry for keeping you waiting for so long.

din1s commented 1 year ago

Thanks a lot! We will try to keep adding products.

Here the customer had another question - did you have the opportunity to add products with Cyrillic in the names?

PrzemyslawLukanowski commented 1 year ago

No, we support only Polish and English base languages of offers.