0

Am trying to get the Iteration Name of the current sprint, So i queried like this, but am getting no results.

    String projectRef = "/project/6376838384";
    QueryRequest  iterationRequest = new QueryRequest("Iteration");
    iterationRequest.setFetch(new Fetch("Name","StartDate","EndDate"));
    iterationRequest.setScopedDown(false);
    iterationRequest.setScopedUp(false);
    iterationRequest.setProject(projectRef);
    Date date = new Date();
    iterationRequest.setQueryFilter(new QueryFilter("Iteration.StartDate", "<=",date.toString()).and(new QueryFilter("Iteration.EndDate", ">=", date.toString())));
    QueryResponse iterationQueryResponse = restApi.query(iterationRequest);
    int numberOfIteraitons = iterationQueryResponse.getTotalResultCount();
    System.out.println("numberOfIteraitons " + numberOfIteraitons);

Please let me know, where am getting wrong..

prabhakar Reddy G
  • 1,039
  • 3
  • 12
  • 23

1 Answers1

1

WSAPI only understands dates formatted in ISO format. If you hard code date to be "2016-12-21" does it work? If so then you just need to format the date object in your code above in that format.

If that doesn't work maybe either your project scoping is incorrect or WSAPI is returning some other error. Are there errors on the query response?

Kyle Morse
  • 8,390
  • 2
  • 15
  • 16