What's the process of jira salesforce integration?
I am new to Salesforce with JIRA integration. I have read about them but I have not found any proper documentation supporting the Integration.
Please suggest.
For Salesforce-Jira integration. We can use the below code to get the JSON response from Jira REST URL
HttpRequest req = new HttpRequest();
req.setEndpoint();
req.setMethod('GET'); // POST if you want to post data to Jira
HttpResponse res = http.send(req);
Refer here (https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis) to form the REST url. Sample url would look like
http://localhost:2990/jira/rest/api/2/issue/10009
Instead of localhost it should be the domain name your organisation has chosen for Jira.
Then you need to parse the JSON response. Loop through it as shown below and deserialize it (parserJira.readValueAs(issue.class)).
String JSONContent = res.getBody();
JSONParser parse Jira = JSON.createParser(JSONContent);
while (parserJira.nextToken() != null) {
if (parserJira.getCurrentToken() == JSONToken.START_ARRAY) {
while (parserJira.nextToken() != null) {
issue jiraIssue = (issue)parserJira.readValueAs(issue.class);
// Your other code
}
}
}
issue is a class version of the JSON. E.g if the json structure that is returned is of the form {issue:{field1:val1,field2:val2}}; then the class would be,
public class issue{
public string field1;
public string field2;
}
For nested json structure the class structure too have to be created accordingly. There is a tool Json2Apex to map a JSON response to Apex Class. Once the json response is deserialized you can access the values with dot notation on the class object as usual:
....
String issue1 = jiraIssue.field1;
….