Graph API Facebook publishing_phase post
public String upVideoJson(String token, String mess, String urlVideo, String times) { String url = "https://graph.facebook.com/v20.0/me/videos"; HttpClient httpClient = HttpClients.createDefault(); String videoId = null; try { HttpPost httpPost = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); String encodedMess = new String(mess.getBytes("UTF-8"), "ISO-8859-1"); builder.addTextBody("access_token", token, ContentType.TEXT_PLAIN); builder.addTextBody("description", encodedMess, ContentType.create("text/plain", "ISO-8859-1")); builder.addTextBody("file_url", urlVideo, ContentType.TEXT_PLAIN); if (StringUtils.hasText(times)) { builder.addTextBody("scheduled_publish_time", times, ContentType.TEXT_PLAIN); builder.addTextBody("published", Boolean.toString(false)); } HttpEntity multipart = builder.build(); httpPost.setEntity(multipart); HttpResponse response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); String responseString = EntityUtils.toString(responseEntity); JSONObject jsonResponse = new JSONObject(responseString); if (jsonResponse.has("id")) { videoId = jsonResponse.getString("id"); } else { System.out.println(token); System.out.println(jsonResponse); } } catch (IOException e) { throw new CustomException(); } return videoId; }
I scheduled the post but until now it still hasn't appeared on the Facebook page. When I use the ID to get the permalink_url, only I can see the video, like published = false. Can anyone help me solve the problem?