How can we create a reporter with api.

I found out how wa can post a request or to create a ticket but somehow I can't figure out how to create a new reporter.

-1
7 comments

Hi! You don't actually need to create new reporters via REST API, as they will be created automatically when the form is submitted. So if you have already found a way to submit a ticket and define an email via API, that will do—the new reporter account with that email will be generated for that ticket automatically.

0

I understand but I'm not using the form, I created my own form. have everything working only need to create a reporter or add a reporter later on in project but I have not seen any input that we can change te reporter.

0

If we are talking about a helpdesk project, the ticket is shared only between the reporter and the team. So you won't be able to change ownership of that ticket later to the user that you create independently. You'll be able to add them to the CC list in the ticket, though. With that said, you can refer to Create New User for more details on user creation via REST API.

0

Thank you for clarifying Stanislav Dubin,

Yes I have tried to use https://www.jetbrains.com/help/youtrack/devportal/HUB-REST-API_Users_Create-New-User.html#RequestBody but some how I could not get this working can you push me in the right direction.

I only need the base lines in JSON to send it to youtrack.

The explaining of is perfect but somehow I get create a user working.
https://www.jetbrains.com/help/youtrack/devportal/api-howto-create-issue.html
 

0

Nick - secforhire here is a sample request body sent to the /hub/api/rest/users endpoint that should create a reporter-type account in YouTrack:

{
    "login": "reporter-created-via-API",
    "userType": {
                "id": "REPORTER"
            }
}
0

Just to add to this dialogue, I have been testing creating Helpdesk issues via the Youtrack REST API. While what Stanislav says above is true, there is more work you have to do in the API to make everything knit together. The below is what I've discovered in trying to solve the same problem Nick - secforhire  is trying to solve - that is, using the REST API to POST a new helpdesk issue to a helpdesk project, but have it reported by a different user/reporter from the user the API credentials are linked to.

 

It appears you have to do the following:

1. Use the Hub REST API to create a user of type REPORTER

2. Use the Hub REST API to link that user to the Helpdesk project (and to do this you need to remember to use the Hub ID to reference your Youtrack objects, which you can fetch by getting the ringID via the YT REST API)

3. Use the YT REST API to find the user you created in Step 1 so you can discover the YT id for the user, because that's what you need in the next step

4. Use the YT REST API to POST the new issue while using the “reporter” attribute like this:
    "reporter": {"id": “1-129”}  // this is the YouTrack id for the user entity

 

Following this process, I can successfully create new helpdesk tickets with the API that are submitted by the reporter as opposed to the API's user account. (Edit: I am still working through an issue with the built-in email service not working correctly for tickets generated this way; I have a support ticket out for that.)

0

Hi Jake Sterling, the notification scheme implemented in helpdesk projects requires that the ticket is created via one of the supported channels: online form or email. There is no official REST API for creating tickets, although it's possible to do so by mimicking the request that the browser makes when the form is filled in (you can check the request in the Network tab of your browser's devtools). This endpoint might or might not change at some point in time as it's not a public API endpoint, but it could work as a workaround for the time being.

0

Please sign in to leave a comment.