O
O
Oleg2020-11-25 19:39:28
Python
Oleg, 2020-11-25 19:39:28

How to unload balances using the ozon API?

Good afternoon.
Please tell me what I'm doing wrong.
I want to get transaction data via api ozon (from a test account).
But I get a 400 error in response.

Link to documentation https://api-seller.ozon.ru/apiref/ru/#t-title_post...

import requests

url = 'https://cb-api.ozonru.me/v2/finance/transaction/list'

data ={"client-id": "836",
        "api-key": "0296d4f2-70a1-4c09-b507-904fd05567b9",
        "content-type": "application/json",
        "filter": {
            "date": {
              "from": "2020-10-01T07:14:11.897Z",
              "to": "2020-10-31T07:14:11.897Z"
            },
            "transaction_type": "all"
            },
            "page": "1",
            "page_size": "10"
        }

r = requests.post(url, data)


Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-11-25
@Oleg_F

client-id and api-key are request headers, not body

import requests

url = 'https://cb-api.ozonru.me/v2/finance/transaction/list'

headers = {'client-id': '836', 'api-key': '0296d4f2-70a1-4c09-b507-904fd05567b9'}

data ={"filter": {
            "date": {
              "from": "2020-10-01T07:14:11.897Z",
              "to": "2020-10-31T07:14:11.897Z"
            },
            "transaction_type": "all"
            },
            "page": "1",
            "page_size": "10"
        }

r = requests.post(url, json=data, headers=headers)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question