I have a java program that uploads a file to a document libary and i have a method that creates a folder. I want the file to be uploaded to the folder but i keeps getting uploaded outside the folder.
If i call the create folder method before the upload file method I get http 403 Forbidden error what could be the problem?
public void createFolder(String digest) throws ClientProtocolException, IOException {
HttpPost request = new HttpPost(
"http://industrial-ex/sites/tifdemo/_api/Web/Folders/add('enovia/newfolder')");
request.addHeader("Content-Type", "application/json;odata=verbose");
request.addHeader("X-RequestDigest", digest);
CloseableHttpResponse response = httpClient.execute(target, request, context);
response.setHeader("Accept", "application/json;odata=verbose");
System.out.println("STATUS CODE Post Folder: " + response.getStatusLine());
}