allegro / allegro-api

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

An error has occurred #3543

Closed shulao2010 closed 4 years ago

shulao2010 commented 4 years ago

Występuje problem:

:beetle: Opis

shulao2010 commented 4 years ago

{'errors': [{'code': 'ERROR', 'message': 'An error has occurred', 'details': None, 'path': '/sale/product-proposals', 'userMessage': None}]}

Hello, I have used the following verification methods: 1.https://allegro.pl/auth/oauth/token?grant_type=authorization_code&code= 2.https://allegro.pl/auth/oauth/device 3.https://allegro.pl/auth/oauth/token?grant_type=client_credentials

However, when I tried to use "sale/product-proposals", the above error occurred.

All of the above authentication methods can successfully obtain the token. It should be successful in some "get" operations. But the above error appeared in some "post" requests.

I now want to upload a product. Could you please give me the simplest standard "body".

url='https://api.allegro.pl/sale/product-proposals' data={ "name": "iPhone 5s", "category": {"id": "124264"}, "parameters": [{"id": "124264",}], "images": [{"url": "https://cbu01.alicdn.com/img/ibank/2020/277/006/16650600772_666556000.jpg"}] }

At this time, I filled out the most basic required items in the API document. But it was never successful. I hope you can give me the simplest one, the parameters needed to upload the product. Thank you

shulao2010 commented 4 years ago

header_info = {"Authorization":'Bearer '+tok,'Accept':'application/vnd.allegro.public.v1+json','content-type': 'application/vnd.allegro.public.v1+json'}

MaciejFrackowiak commented 4 years ago

Please, look into our tutorial about productization - we describe there whole process step by step, you will find also sample request and response.

shulao2010 commented 4 years ago

url='https://api.allegro.pl/sale/offer-contacts'

data={ "product": { "name":"Produkt testowyqweqwe", "category":{"id":"124264"}, "parameters": [ {"id": "15851","values": ["15851_1"]}, {"id": "3786","values": ["3786_319653"]}, {"id": "3806","values": ["3806_407362"]}, {"id": "201041","values": 5.0}, {"id": "451","values": ["451_1"]}, {"id": "3766","values": ["3766_11"]}, {"id": "127662","values": ["127662_3"]}, {"id": "127488","values": ["127488_5"]}, {"id": "127468","values": ["127468_11"]}, {"id": "59","values": ["59_3"]}, {"id": "4126","values": ["4126_206685"]}, {"id": "18160","values": ["18160_212393"]}, {"id": "201025","values": ["201025_380485"]}, {"id": "201017","values": ["201017_2381"]}, {"id": "215930","values": "2"}, {"id": "202477","values": ["202477_4194304"]}, {"id": "216925","values": ["216925_275825"]}, {"id": "201029","values": 5}, {"id": "201033","values": 10.0}, {"id": "201037","values": 10.0}, {"id": "201045","values": 10.0}, {"id": "201089","values": 10.0}, {"id": "201249","values": 10.0}, {"id": "201049","values": 10.0}, {"id": "215918","values": "10"}, {"id": "215926","values": "10"}, {"id": "215922","values": "10"}, {"id": "225693","values": "5402503366976"} ], "images": ["https://cbu01.alicdn.com/img/ibank/2019/212/677/12610776212_2147101084.jpg"]}, "sellingMode": {"price": {"amount": "220.85","currency": "PLN"}}, "stock": {"available": 1} } {'errors': [{'code': 'ERROR', 'message': 'An error has occurred', 'details': None, 'path': '/sale/offer-contacts', 'userMessage': None}]}

MaciejFrackowiak commented 4 years ago

In this request, you used an incorrect resource - /sale/offer-contacts. As I see you opened a new thread in post https://github.com/allegro/allegro-api/issues/3546 so I will answer there.