I am trying to search all favourite Filters (JIRA) from the actual User using c# HttpWebRequest and Rest-Api. I am still able to read Issues but the filters aren't working.
Reading Issues works as follows:
For example I have this URL to get all Issues from project IT:
http://jira-test.myServer.de/rest/api/2/search?jql=project=%22IT%22
I am using DataContractJsonSerializer
to swap the JSON Response to C#-Objects.
From this class I am getting an object after Serialization:
[DataContract]
internal class Kopf
{
[DataMember]
public string startAt = string.Empty;
[DataMember]
public string maxResults = string.Empty;
[DataMember]
public string total = string.Empty;
[DataMember]
public Issues[] issues = null;
}
The first lines of JSON are looking like this:
{"expand":"schema,names","startAt":0,"maxResults":50,"total":23044,"issues":[{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"40000","self":"http://jira-test.myServer.de/rest/api/2/issue/40000","key":"IT-23237","fields":
So I can't understand why the following isn't working for me: This URL give me the right JSON in Browser:
http://jira-test.myServer.de/rest/api/2/filter/favourite
First lines of JSON:
[{"self":"http://jira-test.myServer.de/rest/api/2/filter/10119","id":"10119","name":"Aktiv","description":"Alle Aufgaben die gerade aktiv von mir bearbeitet werden.","owner":{"self":"http://jira-test.myServer.de/rest/api/2/user?username=sb9923","key":"sb9923","name":"sb9923","avatarUrls":{"16x16":"http://jira-test.myServer.de/secure/useravatar?
And here is my Object which I want to serialize:
[DataContract]
internal class FilterData
{
[DataMember]
public FilterKopf[] filter = null;
}
[DataContract]
internal class FilterKopf
{
[DataMember]
public string id = string.Empty;
[DataMember]
public string name = string.Empty;
[DataMember]
public string description = string.Empty;
[DataMember]
public string jql = string.Empty;
}
I don't get any Exception or something but the FilterKopf Array in the FilterData-Object is always null.
I hope someone can help me with this. I think my C#-Class is the problem because the JSON seems fine and my browser gives the right output.