Closed pantosh closed 1 year ago
For what it is worth, this clumpsy workaround will create a new issue, but without drafting:
private async Task<Issue> AlternativeCreateIssue(string projectId, Issue issue)
{
var client = await connection.GetAuthenticatedApiClient();
var apiProjects = await client.AdminProjectsGetAsync("id,shortName", 0, -1);
var project = apiProjects.Single(x => x.ShortName == projectId);
var apiIssue = new YouTrackSharp.Generated.Issue
{
Project = project,
UsesMarkdown = issue.IsMarkdown
};
if (!string.IsNullOrEmpty(issue.Summary))
{
apiIssue.Summary = issue.Summary;
}
if (!string.IsNullOrEmpty(issue.Description))
{
apiIssue.Description = issue.Description;
}
var newApiIssue = await client.IssuesPostAsync("", null, null, apiIssue);
var issuesService = connection.CreateIssuesService();
return await issuesService.GetIssue(newApiIssue.Id);
}
@pantosh Hi, thank you for the report!
Could you please check though, which are your YouTrack AND YouTrackSharp versions?
The endpoint /admin/users/me/drafts
was obsoleted in favor of /users/me/drafts
in version 2022.3 (see commit 7f37ed8ec3da254b107af7f28bdcd83d459e28b7 for related changes in the library). This endpoint is not "public" (not present in openapi spec), hence the drastic change, however it unfortunately still remains the only most generic way to retrieve all unknown custom field prototypes.
If, for example, you are running YT Standalone 2021.* but you need some fixes not present in 2021.3 versions of the library, I would gladly backport them.
I am using Jetbrains hosted YT. Build 2023.1.17582
Checking up on my NuGet I found that it was out of date. CreateIssue is working with 2022.3.1. I will close the issue.
Thank you for checking! Don't hesitate to write us if any other issue arise
Expected behavior
Expected a new issue to be created for a specific project short name.
Actual behavior
404 error when AdminUsersMeDraftsAsync is called to draft the issue. There is no obvious easy workaround.
Steps to reproduce the behavior
Create a new issue using
public async Task<string> CreateIssue(string projectId, Issue issue)
inIssuesService
will throw a YouTrackErrorException:The issue drafting was introduced in #111 in commit 3f62b794170895d7048c2691ed58a96844e456c8
This non-draft REST code will correctly create a new issue:
Notice that the project id, here 99-99 as example is a YouTrack project id, not the shortnames used in the YouTrackSharp library.
Suggestion: Fix issue and make it possible to also create a non-drafted issue using the api/issues REST call above.