-
Notifications
You must be signed in to change notification settings - Fork 105
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
doesn't support the new API on 2019.1 #83
Comments
An API overhaul has been done in 2019.1. We are looking at working on a new version of YouTrackSharp, for now 2019.1 is unfortunately not supported. |
Thank you for your reply. I guess this will take some time? I'm using 3 Endpoints so far, so I'll then create a light-weight client on my own until an official new version will be released. |
Yes, will take a bit of time, sorry for the hiccup :) |
@bschaeublin Would you mind trying with the 2019.1 prerelease version from NuGet?
|
@maartenba Thank you! At least GetIssueCount does work now. |
That could be a data problem indeed. Do you see the same issue with other queries or only this one? |
I've managed to successfully run a query on a small test project. Is there a way to provide some more details on the 500 Issue? Can you reproduce the issue with any querys on bigger projects and paging through? We're using it as SAAS, but I don't think i've enough privileges to get some logs. |
Paging seems to work, just added a unit test testing this explicitly: 5116ca8 Could you perhaps reach out to YouTrack support to troubleshoot that 500 error? |
I had some time (holidays!) and managed to find out some stuff. I edited your unit test to connect to our youtrack instance and changed the test a bit: [Fact]
public async Task Valid_Connection_Page_Issues()
{
// Arrange
var url = "an url";
var token = "a token";
var con = new BearerTokenConnection(url, token);
var service = con.CreateIssuesService();
// Act
var totalResultsCount = 0;
var skip = 0;
while (skip < 1000)
{
var result = await service.GetIssues("resolved date: 2018-02 .. 2019-01", skip, take: 100);
if (result?.Count > 0)
{
totalResultsCount += result.Count;
}
else
{
break;
}
skip += 100;
}
// Assert
Assert.True(totalResultsCount > 100);
} The test failed, so i edited the I compared the api results and discovered that the new api endpoint does not return all fields per default. So maybe it has to do with one field. I reverted my changes and modified the GetIssue Method to return just the fields that i want. I was wondering if the new api could handle it, and added the field in the request (see following sample) and rerun the unit test. public async Task<ICollection<Issue>> GetIssuesv20191(string filter = null, int? skip = null, int? take = null, bool wikifyDescription = false)
{
var queryString = new List<string>(5);
if (!string.IsNullOrEmpty(filter))
{
queryString.Add($"filter={WebUtility.UrlEncode(filter)}");
}
if (skip.HasValue)
{
queryString.Add($"after={skip}");
}
if (take.HasValue)
{
queryString.Add($"max={take}");
}
queryString.Add("fields=id,links");
queryString.Add($"wikifyDescription={wikifyDescription}");
var query = string.Join("&", queryString);
var client = await _connection.GetAuthenticatedHttpClient();
var response = await client.GetAsync($"api/issues?{query}");
if (response.StatusCode == HttpStatusCode.NotFound)
{
return null;
}
response.EnsureSuccessStatusCode();
var resultStr = await response.Content.ReadAsStringAsync();
var issues = JsonConvert.DeserializeObject<Issue[]>(resultStr);
return issues;
} The new api is not documented the way the old one was - so I have no idea how we get the new API endpoint to return all fields per default. If this would be possible we would have to change the endpoints from "/rest/issue" to "/api/issues" and change all the query parameters accordingly. What do you think? And some thoughts at the end: |
Regarding the error 500, can you email me the query, project name and instance name? |
thank you for taking a look - i've sent it. |
After e-mail discussion this got flagged as a bug in YouTrack itself. Will proceed with 2019. release of this library. |
Expected behavior
getting a list of issues should not get a 404.
Actual behavior
getting a list of issues results in a 404, after our youtrack instance was updated to 2019.1
Steps to reproduce the behavior
Code which broke after Youtrack was updated
https://example.myjetbrains.com/youtrack/rest/issue?filter=test
Steps to solve the problem:
So it seems there were multiple breaking changes in the new API Version, which this library does not support at this point.
The text was updated successfully, but these errors were encountered: