Answer the question
In order to leave comments, you need to log in
How to send POST request to VK API?
Hi all!
In general, I'm trying to send a POST request:
r = requests.post('api.vk.com/method/stories.markSeen?stories=500824785_456239034&access_token=193333333333f74b498fa45e41cc62c384baa28db89819e301b3a88cf6b5a460aef408d93de0&v=5.101', params=field)
{"error":{"error_code":3,"error_msg":"Unknown method passed","request_params":[{"key":"stories","value":"500824785_456239034"},{"key":"v","value":"5.102"},{"key":"method","value":"stories.markSeen"},{"key":"oauth","value":"1"}]}}
Answer the question
In order to leave comments, you need to log in
Not strong in Python, but your uri looks like a GET request.
in POST requests, the data must be passed in the body of the request. How it should look like:
data = ['stories': '500824785_456239034', 'access_token': 'token', 'v': '5.101'];
r = reqiest.post('url/method.stories/', data);
markSeen()
Only bookmarks have a
method : fave.markSeen()
The resulting error message is about this very reason and says:
"Unknown method passed"
Try calling existing VK API methods .
import requests
payload = {
'access_token': 'XXXXXXX',
'v': '5.101'
}
r = requests.post('https://api.vk.com/method/users.get', data=payload)
print(r.text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question