Open Rahovski opened 1 year ago
For example method market.get take parametrs date_from and date_to in native format.
Request with error
https://api.vk.com/method/market.get?access_token={token}&owner_id=-85689507&v=5.131&offset=0&count=1&date_from=1660083630
Answer
{ "error": { "error_code": 100, "error_msg": "One of the parameters specified was missing or invalid: period, date_from is invalid", "request_params": [ { "key": "method", "value": "market.get" }, { "key": "oauth", "value": "1" }, { "key": "owner_id", "value": "-85689507" }, { "key": "count", "value": "1" }, { "key": "offset", "value": "0" }, { "key": "date_from", "value": "1660083630" }, { "key": "need_variants", "value": "0" }, { "key": "with_disabled", "value": "0" }, { "key": "v", "value": "5.131" } ] } }
Correct request
https://api.vk.com/method/market.get?access_token={token}&owner_id=-85689507&v=5.131&offset=0&count=1&date_from=10.08.2022
{ "response": { "count": 33, "items": [ { "availability": 0, "category": { "id": 30417, "name": "Скейтборды и лонгборды", "section": { "id": 10005, "name": "Спорт и отдых" } }, "description": "Длина: 48\nШирина: 9.5\nКонкейв: U-образный\nФлекс: мягкий, средний, жесткий\nТейлы: 13, 14, 15см\nПолиуретановая защита по всему периметру\nДизайн: Катя Войнова", "id": 6996779, "owner_id": -85689507, "price": { "amount": "2090000", "currency": { "id": 643, "name": "RUB", "title": "₽" }, "text": "20900 ₽" }, "title": "Inari Limited", "is_owner": false, "is_adult": false, "thumb_photo": "https://sun1-86.userapi.com/impg/8hNEdxiX4SVRvdWfoq2w3M1bNAec26YMJfo89g/oRnEDxKMbAI.jpg?crop=0,0.217,1,0.566&size=400x0&quality=95&sign=dff7829b1287259e04e06f5feb939f24&c_uniq_tag=vl-y7yC5xLSi8BLJTJyIf4ZTzI8dx3X1bvto-nfbo-A", "cart_quantity": 0, "item_rating": { "rating": 0, "reviews_count": 0, "reviews_count_text": "Нет отзывов" } } ] } }
In file VkParameters.cs method
public void Add(string name, DateTime? nullableDateTime)
Convert DateTime arg to unix time format, but some methods in api request native datetime
Problem
For example method market.get take parametrs date_from and date_to in native format.
Example:
Request with error
Answer
Correct request
Answer
Where problem
In file VkParameters.cs method
Convert DateTime arg to unix time format, but some methods in api request native datetime
Possible solution