You need to sign in to do that
Don't have an account?
suji srinivasan
Hi , i need to integrate salesforce with jira using Post method-Rest API
If i create project in salesforce, it should get create in jira
global with sharing class Jiraproject {
global static void createproject(string Name) {
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeStringField('Name', Name);
//gen.writeStringField('Id',Id);
//gen.writeStringField('status__c',status__c);
gen.writeEndObject();
String jsonString = gen.getAsString();
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('url');
request.setMethod('POST');
String username = 'kh@abc.com ';
String password = ' PcuTBIDoQ96784';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' +
EncodingUtil.base64Encode(headerValue);
request.setHeader('Authorization', authorizationHeader);
request.setHeader('Content-Type','application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody (jsonString);
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if(response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
}
can anyone guideme? Thanks in advance
global with sharing class Jiraproject {
global static void createproject(string Name) {
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeStringField('Name', Name);
//gen.writeStringField('Id',Id);
//gen.writeStringField('status__c',status__c);
gen.writeEndObject();
String jsonString = gen.getAsString();
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('url');
request.setMethod('POST');
String username = 'kh@abc.com ';
String password = ' PcuTBIDoQ96784';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' +
EncodingUtil.base64Encode(headerValue);
request.setHeader('Authorization', authorizationHeader);
request.setHeader('Content-Type','application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody (jsonString);
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if(response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
}
can anyone guideme? Thanks in advance
Refer the below links will help you to proceed further.
https://dev.to/grushaisergii/how-to-integrate-jira-and-salesforce-342c
https://www.ergonized.com/blog/jira-salesforce-integration/
Thanks!!
Try this
https://www.ergonized.com/blog/jira-salesforce-integration/