-1

I need to find all Issues that are updated and created today in Jira. Im able to get an issue by passing a single Issuekey value to the url in my apex code. Help me in Querying a list of issues which are updated and created today.

This is my apex class.

public with sharing class GetIssues {

  public static void Getfields(String JIRA_Key) {

    HttpRequest req = new HttpRequest();
    HttpResponse res = new HttpResponse();
    Http http = new Http();

    String username = 'admin';
    String password = 'admin';

    Blob headerValue = Blob.valueOf(username+':'+password);
    String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
    req.setHeader('Authorization', authorizationHeader);
    req.setHeader('Content-Type','application/json');

    String endpoint = 'https://mysfjira.atlassian.net/rest/api/2/issue/'+JIRA_Key;

    req.setMethod('GET');
    req.setEndpoint(endpoint);
    res = http.send(req);

   }
}
mounika
  • 1
  • 1
  • You posted this in Salesforce stack and we told you there that this is Jira work, Jira will need to POST updates to you or they will need to fire an event. – EricSSH Apr 02 '17 at 03:38
  • Thanks @EricSSH. Im trying to get list of issues by jql, im getting result as {"startAt":0,"maxResults":50,"total":0,"issues":[]} without passing the issuekey. I couldn't able to fetch issues fields and values. Im a begginer of coding, so like to get a proper way of fetching issue records from Jira and assigning to the lists in my apex code. – mounika Apr 02 '17 at 07:02
  • You won't be able to get changes from JIRA when they happen on their system what is the response you are getting JIRA that you want to handle? – EricSSH Apr 02 '17 at 07:10

1 Answers1

0

Something like:

created <= startOfDay("-24h")

should work.

More information available at http://confluence.atlassian.com/display/JIRA/Advanced+Searching#AdvancedSearching-startOfDay

Ankit
  • 88
  • 7