allegro-api icon indicating copy to clipboard operation
allegro-api copied to clipboard

Access denied for sale/product-proposals in sandbox

Open din1s opened this issue 3 years ago • 47 comments

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

din1s avatar Aug 16 '22 06:08 din1s

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

PrzemyslawLukanowski avatar Aug 16 '22 07:08 PrzemyslawLukanowski

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

din1s avatar Aug 16 '22 09:08 din1s

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

PrzemyslawLukanowski avatar Aug 16 '22 10:08 PrzemyslawLukanowski

Everything was filled in, the Access denied error remained

din1s avatar Aug 16 '22 11:08 din1s

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

PrzemyslawLukanowski avatar Aug 16 '22 11:08 PrzemyslawLukanowski

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?

din1s avatar Aug 17 '22 07:08 din1s

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
}

PrzemyslawLukanowski avatar Aug 17 '22 07:08 PrzemyslawLukanowski

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?

din1s avatar Aug 23 '22 09:08 din1s

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

PrzemyslawLukanowski avatar Aug 23 '22 10:08 PrzemyslawLukanowski

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"}}

din1s avatar Aug 26 '22 05:08 din1s

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.

PrzemyslawLukanowski avatar Aug 26 '22 06:08 PrzemyslawLukanowski

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"
  }
}

din1s avatar Aug 26 '22 06:08 din1s

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

PrzemyslawLukanowski avatar Aug 26 '22 06:08 PrzemyslawLukanowski

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"
      ]
    }
  ]
}

din1s avatar Aug 26 '22 07:08 din1s

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.

PrzemyslawLukanowski avatar Aug 26 '22 07:08 PrzemyslawLukanowski

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?

din1s avatar Aug 31 '22 07:08 din1s

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

PrzemyslawLukanowski avatar Aug 31 '22 08:08 PrzemyslawLukanowski

Our client ID 3f3f856f695244d5ad810***********

din1s avatar Aug 31 '22 08:08 din1s

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?

PrzemyslawLukanowski avatar Aug 31 '22 08:08 PrzemyslawLukanowski

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.

din1s avatar Sep 06 '22 08:09 din1s

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.

PrzemyslawLukanowski avatar Sep 06 '22 08:09 PrzemyslawLukanowski

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?

din1s avatar Sep 08 '22 10:09 din1s

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.

PrzemyslawLukanowski avatar Sep 08 '22 10:09 PrzemyslawLukanowski

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?

din1s avatar Sep 08 '22 11:09 din1s

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.

PrzemyslawLukanowski avatar Sep 08 '22 11:09 PrzemyslawLukanowski

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"}

din1s avatar Sep 09 '22 06:09 din1s

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.

PrzemyslawLukanowski avatar Sep 09 '22 06:09 PrzemyslawLukanowski

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.

din1s avatar Sep 15 '22 05:09 din1s

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

PrzemyslawLukanowski avatar Sep 15 '22 06:09 PrzemyslawLukanowski

Good afternoon! Any news on our issue?

din1s avatar Sep 16 '22 10:09 din1s