- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Pam,
Which client are you using to connect to the API ?. I used the apache http client and wrote a sample java program and i could able to populate the hierarchy from CSV file. you need the convert the given csv file to string format and send it in request. Please see below the code snippet.
//URL will be like https://10.112.58.103:443/vCenter-CB/api/hierarchy/41878/populate
PostMethod postMethod = new PostMethod(URL);
HttpClient client = new HttpClient();
FileReader fr = new FileReader("HierarchyCSV.csv");
BufferedReader br = new BufferedReader(fr);
String s;
StringBuffer sb = new StringBuffer();
while((s=br.readLine())!=null)
{
sb.append(s);
sb.append("\n");
}
postMethod.setRequestEntity(new StringRequestEntity(sb.toString(),null,null));
client.executeMethod(postMethod);
The contents of the sample input CSV which i used is
#version 1.5.0
1,CB-folder,-1,101
2,CB-folder-1,1,101,vCenter Chargeback entity
3,Datacenters,1,0,10.112.58.52,group-d1,1
4,Datacenters,2,0,10.112.58.53,group-d1,2
Please let me know if you need more information.
Thanks,
Lakshmi