0

I try to get all info about user at Vkontakte. At first time, when i insert one uid- it works well. But, when i insert two or more uids:

<?xml version=\"1.0\" encoding=\"utf-8\"?><error><error_code>100</error_code>                                               
<error><error_code>100</error_code> 
<error_msg>One of the parameters specified was missing or invalid: user_id not            
integer</error_msg><request_params list=\"true\"><param><key>oauth</key><value>1</value>

and so on.

My code:

public System.Xml.XmlDocument GetUsers(string[] user_ids, string[] fields, string name_case)
    {
        NameValueCollection qs = new NameValueCollection();
        String uids = user_ids[0];
        String myFields = fields[0];

        for (int i = 1; i < user_ids.Length; i++)
        {
                uids += "," + user_ids[i];               
        }
        for (int i = 1; i < fields.Length; i++)
        {
                myFields += "," + fields[i];               
        }
        qs["user_id"] = uids;
        qs["fields"] = myFields;
        qs["name_case"] = name_case;

        XmlDocument doc = Logic.ExecuteCommand("users.get", qs, "");
        if (doc != null)
            return doc;
        else throw new NotImplementedException();
    }

Doc from users.get functions: http://vk.com/dev/users.get

They say, that i should use comma: Param user_ids: User IDs or screen names (screen_name). By default, current user ID. list comma-separated strings, the maximum number of elements allowed is 1000.

Please,tell me how to insert two or more uids to request. Thanks.

user2545071
  • 1,408
  • 2
  • 24
  • 46

1 Answers1

2

You should use "uids" parameter name instead of "user_id", so in your code should be

qs["uids"] = uids;
tsds
  • 8,700
  • 12
  • 62
  • 83