D
D
Delphinum2017-09-25 15:52:57
PHP
Delphinum, 2017-09-25 15:52:57

How to correctly pass filter parameters when requesting the search.tagContents method in the Odnoklassniki API?

I'm trying to request content marked with a specific tag from 2017-09-25, I execute the following request:
7c794937625b496b89b3b1ce0e2c9a67.png
as a result, I get data for the previous numbers:
21ba0e8dd2684dd8956daab78c98b369.png
I tried to filter the result by types, but similarly received data of all types, not those specified in the filter.
Perhaps I somehow incorrectly pass the filter parameters in the request:

return (new Client)->request(
      'get',
      sprintf(
        'https://api.ok.ru/fb.do?%s',
        http_build_query([
          'anchor' => $anchor,
          'application_key' => $this->options['client_public'],
          'count' => 2,
          'filter' => [
            'since' => !is_null($date)? $date->format('Y-m-d H:i:s') : null,
          ],
          'format' => 'json',
          'method' => 'search.tagContents',
          'query' => $this->filter['tag'],
          'sig' => $sig,
          'access_token' => $this->options['access_token'],
        ])
      )
    );

The API does not complain about the request format, but simply does not take into account the filtering parameters.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Egorichev, 2017-09-26
@Delphinum

The filter should have the following format:
{"since": "2017-08-26 00:00:00", "until": "2017-09-26 00:00:00", "types": ["GROUP_TOPIC" ]}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question