-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usersEndpoint: create or update user #107
Comments
Could you point out to me how you use the method? Or could you compare it to the unit tests: The unit tests also check for the payload. Hence an empty object should make the tests fail. |
see #67 for a more convenient way to create instances |
I used the method as follow: this.knoraApiConnection.admin.usersEndpoint.createUser(this.form.value).subscribe(
(response: ApiResponseData<UserResponse>) => {
this.user = response.body.user;
},
(error: ApiResponseError) => {
this.errorMessage = error;
}
); But as #67 says, I have to initiate the data with |
So I have to write as follow: const userData: User = new User();
userData.username = this.form.value.username;
userData.familyName = this.form.value.familyName;
userData.givenName = this.form.value.givenName;
userData.email = this.form.value.email;
userData.password = this.form.value.password;
userData.systemAdmin = this.form.value.systemAdmin;
userData.status = this.form.value.status;
userData.lang = this.form.value.lang;
this.knoraApiConnection.admin.usersEndpoint.createUser(userData).subscribe(
(response: ApiResponseData<UserResponse>) => {
this.user = response.body.user;
},
(error: ApiResponseError) => {
this.errorMessage = error;
}
); It's a little awkward, but ok. Thanks @tobiasschweizer |
Yes, it is indeed inconvenient! We will try to come up with a better solution in #67 |
I'm not able to create a user (or update user). In the app we have a form to create new user and I submit for example the following data:
I get an error
400 Bad Request
with the message: "The request content was malformed:Object is missing required member 'username'". I figured out, that the request payload is an empty object
{}
. It seems to be something's wrong in thecreateUser
method in usersEndpoint. I have similar issues inupdateUserBasicInformation
or in projectsEndpoint. It always converts my payload data into an empty object. Probably because ofjsonConvert.serializeObject
?The text was updated successfully, but these errors were encountered: