Answer the question
In order to leave comments, you need to log in
Implementation of post request to vk api?
I made requests to VK via get without problems)
resp, err := http.Get("https://api.vk.com/method/users.get?user_ids=" + id + "&fields=about,activities,books .....
resp, err := http.Post("https://api.vk.com/method/users.get","POST",_)
Answer the question
In order to leave comments, you need to log in
Content type can be used application/x-www-form-urlencoded, in the body you can pass exactly those parameters that do not pass along the length in GET. For example, if you need to send a long text.
The body format can be found on Wikipedia https://ru.wikipedia.org/wiki/POST_(HTTP) .
Vkontakte support team
import (
...
"net/http"
"net/url"
"strings"
...
)
func main() {
...
data := url.Values{}
data.Add("user_ids", id)
data.Add("fields", "about")
data.Add("fields", "activities")
data.Add("fields", "books")
resp, err := http.Post("https://api.vk.com/method/users.get", "POST", strings.NewReader(data.Encode()))
...
}
POST will not play a role here. Divide the required parameters into two parts and make two requests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question