I can not figure out how to attach a link in the attachments field
I can not understand in what format to send
there is an object link
and it has fields
url — адрес ссылки; title — заголовок ссылки; description — описание ссылки; image_src — адрес превью изображения к ссылке (если имеется); preview_page — идентификатор wiki страницы с контентом для предпросмотра содержимого страницы, который может быть получен используя метод pages.get. Идентификатор возвращается в формате "owner_id_page_id"; preview_url — адрес страницы для предпросмотра содержимого страницы.
I understand that you need to make a request in the format attachments = link url_title_description_previewpage_previewurl
I can not figure out what to insert in the preview_page and preview_url fields and whether I understood the request format correctly
`static void makeAComment (String ownerId, String newsId, String textComment, String apiToken, String attachments) throws IOException {
String requestUrl = "https://api.vk.com/method/wall.addComment?owner_id=" + ownerId + "&post_id=" +newsId+"&text=" +textComment+"&attachments="+attachments+"&access_token=" + apiToken; System.out.println("request url: " + requestUrl); URL obj = new URL(requestUrl); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); con.setDoOutput(true); int responseCode = con.getResponseCode(); System.out.println("Sending 'GET' request to URL : " + requestUrl); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); }`