D
D
Dmitry Goncharov2018-03-26 11:50:08
PHP
Dmitry Goncharov, 2018-03-26 11:50:08

Why is there an error in vk api appWidget.Update?

Call the appWidget.Update method with the following parameters

$data = array(
    
    'type' => 'list',
    'access_token' => $token,
    'v' => '5.73',
    'code' => '
    var u = API.users.get()[0];
    var name = u.first_name + " " + u.last_name;
    var id = u.id; 
        return {
            "title": "Тест",
            "rows":
                [
                    { "title": "Лучший пользователь - " + name,"descr": "Да-да, это ты.","icon_id" : "id" + id}
                ]
            
        };'
);

An error occurs
[error_code] => 100
[error_msg] => One of the parameters specified was missing or invalid: rows[0].icon_id is not valid user id
[request_params] => Array
However, the call from the application itself via js with the same parameters
let execute = 'var u = API.users.get()[0];var name = u.first_name + " " + u.last_name; var id = "id" + u.id; return {"title": "тест", "rows": [{ "title": "Лучший пользователь - " + name, "icon_id" : id, "descr": "Да-да, это ты."}]};'; 

VK.callMethod("showAppWidgetPreviewBox", 'list', execute)

works great.
Why? How can this be fixed? Or is there some other way to display the user's avatar?
I also tried to get Photo_id and run with it, the same error

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question