Set up credentials when creating a new user through the API

I`m trying to create reporter and new issue on behalf of him. But new user doesn't get notifications.

When i`m using YT feedback form to create issue everithing works fine: user created, issue created, user has some credentials and receives an email with issue link.

But when i`m trying to do the same through api I get the following: user created, issue created, but user has no credentials and no email received.

my steps:

  • create reporter POST /hub/api/rest/users
    user_data = {
           "login": name,
           "password": TEMP_PASSWORD,    # it doesn't affect anything
           "profile": {"email": email},
           "userType": {"id": "REPORTER"},
  • create issue POST /api/issues
    issue_data = {
           "project": {"id": YOUTRACK_PROJECT_ID},
           "summary": f"Feedback from {email}",
           "description": description,
           "reporter": {"ringId": user_id},

If I then use the feedback form with programmatically created user email, user will receive an email, but will not be able to open issue from the email link.
If I manually add credentials to the user and then use the feedback form, user will be able to open issue from the email link.

I conclude that if I can create the credentials programmatically when I create the user, that will solve my problem. Can I do it?
Or how to achieve through the api that the newly created reporter can receive notifications?

Official comment

Hi Sergii Pachkovskyi,

This is Julia from YouTrack Support.

It doesn't look like there's a way to trigger the email notification by creating a ticket via the REST API. As a workaround, I'd suggest sending a POST request to the form itself. Please note that the form expects the content to be multipart/form-data rather than JSON. So, you'd need to send a body like this:

Content-Disposition: form-data; name="feedbackForm"

{"summary":"Feedback from {email}","email":"email","description":"description","fields":[<other form fields like Priority should be included here>]}

You can learn more about the request structure by inspecting the Network tab in DevTools when creating a ticket in the UI.

Although no... after adding credentials, the user starts receiving notifications through the feedback form, but not through the API.

Then I have two questions: 
How to add credentials when creating a user?
How can I force the default notification when using the API?


 Yes, it works. Thanks!


Please sign in to leave a comment.