java - Move a project to a group with Gitlab Api v3 -


i'm using gitlab api v3 task. i'm using java.

i can action , also, create new project via post request (with private token of admin user)

now i'm trying move project specific group. i've got difficulties understand how create post request (in java) info given in documentation "transfer project group".

thank in advance help

edit: 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"); // admin token     connection.setusecaches (false);      dataoutputstream wr = new dataoutputstream(connection.getoutputstream ());     wr.writebytes(urlparameters);     wr.flush();     wr.close();     connection.disconnect(); } 

you try , follow method described in "java - sending http parameters via post method easily", except string urlparameters, replace said parameters ones mentioned in "transfer project group" section:

string id            = ... // (the right group id); string project_id    = ... // (the right project id); string urlparameters = "/groups/:"+id+"/projects/:"+project_id; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -