I want to test a API (Post method). I have to test this API by changing all the available parameters. For EG in Test case one I only change the user Name, in Test case 2 I change only the password and henceforth.
My API looks something like below :
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ibm:params:scim:schemas:extension:bean:agc:2.0:User"
],
"name": {
},
"userName": "GROUPTEST12134",
"password": "Asdfg12@sdd",
"emails": [{
"value": "steve.hok123@awe.com"
}],
"phoneNumbers": [{
"value": "70422330098"
}],
"urn:ibm:params:scim:schemas:extension:bean:agc:2.0:User": {
}
}
I am successfully able to test it by below method :
String urlParameters = "{\"schemas\": [\"urn:ietf:params:scim:schemas:core:2.0:User\",\"urn:ibm:params:scim:schemas:extension:bean:agc:2.0:User\"],\"name\": {},\"userName\": \"GROUPTEST12138\",\"password\": \"Asdfg12@sdd\",\"emails\": [{\"value\": \"steve.hok1234@awe.com\"}],\"phoneNumbers\": [{\"value\": \"\"}],\"urn:ibm:params:scim:schemas:extension:bean:agc:2.0:User\": {}}";
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setDoOutput(true);
con.setRequestMethod("PUT");
con.setRequestProperty("Content-Type", "application/scim+json");
con.setRequestProperty("Accept", "application/scim+json");
con.setRequestProperty("realm", "Ideas");
con.setRequestProperty("Authorization", "Bearer " + BearerToken);
But I am looking for some way where I don't have to manage this urlParameters
.
Can you please some ideas how this can be achieved?