I'm using the Gitlab Api v3 to do some task. I'm using Java.
I can do all the Get action and also, create a new project via a Post request (with the private token of the admin user)
Now I'm trying to move this project to a specific group. But I've got some difficulties to understand how to create a post request (in Java) with the info given in the documentation "transfer project to group".
Thank you in advance for your help
Edit: my code
public void moveProjectToGroup(String projectName, String groupName) throws IOException
{
int id_project = getProjectId(projectName); //32
int id_group = getGroupId(groupName); //14
System.out.println("project id:"+id_project+"\t group id:"+id_group);
String urlParameters = "groups/:"+id_group+"/projects/:"+id_project;
System.out.println(remote); // http://mygitlab/api/v3/
System.out.println(remote+urlParameters); //http://mygitlab/api/v3/groups/:14/projects/:32
URL url = new URL(remote);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("PRIVATE-TOKEN", "7wHppgzq4HxbxvZVWyso"); // my admin token
connection.setUseCaches (false);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream ());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();
connection.disconnect();
}