F
F
Faizator2016-03-04 17:58:44
Classmates
Faizator, 2016-03-04 17:58:44

How to get survey results in a media topic?

There is a web application that, through WidgetMediatopicPost, has the ability to post with attached pictures and a poll on the user's wall.
Attachment looks like this:

$attachment = '{
            "media":[
                          {
                            "type":"poll",
                            "question":"Что купить?",
                            "answers":
                                [
                                  {"text":"То, что слева"},
                                  {"text":"То, что справа"}
                                ],
                    "options":"SingleChoice,AnonymousVoting"
                  },

                  {
                  "type": "photo",
                            "list": [
                                {
                                    "photoId": "'.$photos[0]['assigned_photo_id'].'"
                                },
                                {
                                    "photoId": "'.$photos[1]['assigned_photo_id'].'"
                                }
                            ]
                }
          ]
        }';

As a result, the post is successfully created and the post ID is returned.
e28696c32a8c4f87a0e3bb2b6ba7b187.png
Array
(
    [type] => success
    [id] => 65041556597688
    [signature] => d668c42312d238a02883209c36a14ef6
)

Problems arise when I try to extract information about this post, in particular - the results of voting.
I make a request via PhpSdk ( https://github.com/apiok/php_sdk/blob/master/odnok... ):
OdnoklassnikiSDK::makeRequest("mediatopic.getByIds", ["topic_ids"=>"65041556597688", "fields"=>"poll.*"]);

But the answer comes
Array
(
    [media_topics] => Array
        (
            [0] => Array
                (
                    [ref] => media_topic:65041556597688
                )

        )

    [entities] => Array
        (
        )

)

As you can see, no information about the attached survey is returned.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Ozhiganov, 2016-03-04
@Faizator

You need to add
media_topic.media and media_topic.media_poll_refs to the fields.
The method initially returns a media topic, not a poll, so you must first get the dependency of the media topic on the poll.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question