How to use keystone API extenstion to send a JSON format request “add global role to user ”?
I also ask this question in:
http://
I want to use java to send a JSON format request to add an Admin role for openstack users, I see there is an keystone API extension that provide the "add global role to user" API:
Theis is the link
2.1.1.5. Add Global roles to a user
http://
devguide/
but I do not know how to send this in a correct way by JSON format, the following is my code: I can get "key_admin_url" in another method,it is like: http://
user_id and role_id are two strings.
//create connection
public static void addRole(){
try{
URL url = new URL(key_admin_url + "/users/" + "user_id" + "/roles/OS-KSADM/" + "role_id");
//put request
DataOutpu
//read response
BufferedReader reader = new BufferedReader(new InputStreamReader(
String lines;
while ((lines = reader.readLine()) != null) {
lines = new String(
}
// disconnect
} catch (MalformedURLEx
// TODO Auto-generated catch block
} catch (UnsupportedEnc
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
But I did not succeed and get :java.io.
Is there anyone know how to send a correct JSON request to add role to users? Thank you very much.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Liang Chen
- Solved:
- Last query:
- Last reply: