S
S
Sergey2014-10-29 19:52:33
In contact with
Sergey, 2014-10-29 19:52:33

Vkontakte api. What is the maximum length of wall.post?

Good afternoon. I sent a message to the group, but when sending a large text, I get the error "(400) Invalid request." Messages with small text are published regularly.
Send code:

string msg = HttpUtility.UrlEncode(text.ToString());
string post = "https://api.vk.com/method/wall.post?owner_id=-78594874&lang=0&message=" + msg + "&access_token=" + token;
     
WebRequest request = WebRequest.Create(post);           
        
HttpWebResponse response = (HttpWebResponse)request.GetResponse();             
        
Stream dataStream = response.GetResponseStream();
            
StreamReader reader = new StreamReader(dataStream);
         
string responseFromServer = reader.ReadToEnd();
           
Console.WriteLine(responseFromServer);
            
reader.Close();
dataStream.Close();
response.Close();

text - StringBuilder
token - string

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sydorenko, 2014-10-29
@Reaktor488

You are forming a GET request, the length of which with parameters should not exceed 8192 bytes . I think API contact has nothing to do with it. Look for options for sending a larger message other ways (for example, sending via POST, or whatever else they have there)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question