I have created a REST API in WSO2 ESB. Below is the request service for the POST method:
createUser: function(aUser) {
var myCreateUserRequest = {
"User": {
"UserName": aUser.Username,
"UserPassword": aUser.Password,
"OrganizationId": aUser.OrgId,
"UserStatus": "Active", }}
//Making API Call
var promise = $http.post(API_URL,myCreateUserRequest,REQUEST_HEADER).then(
function(aCreateUserResponse) {
return [aCreateUserResponse.data.CreateUserResponse.Result.ResponseCode,''];
});
return promise; },
Similarly, I now want to pass only two parameters (UserName and Organization ID) to GET a user using angular js. I have started implementing this as shown below:
getUser: function() {
params = {"UserName": aUser.Username, "OrganizationId": aUser.OrgId}
//Making API Call
var promise = $http.get(API_URL,params,REQUEST_HEADER).then(
function(aGetUserResponse) {
return [aGetUserResponse.data.GetUserResponse.Result,''];
});
return promise; },
Is this the correct approach or should I do it differently?