API calls in Camunda-Spring Boot

I’m trying to retrieve data into a Service Bean from an extrernal microservice source .
But its giving a NullPointerException (Unsuccessful HTTP response in Cockpit).
I’m getting proper response in other Spring boot project though.
Below is my code :-

@Component(value=“cibil”)
public class cibil implements JavaDelegate {
private static final Logger LOGGER = LoggerFactory.getLogger(cibil.class);

@Override
public void execute(DelegateExecution execution) throws Exception {
	try {
	RestTemplate restTemplate = null;
	String cibildemo = restTemplate.getForObject("https://jsonplaceholder.typicode.com/users", String.class);
	execution.setVariable("cibildemo", cibildemo);
	LOGGER.info( (String) execution.getVariable("cibildemo"));
	}catch(Exception e) {
	LOGGER.info("In Exception");	
	}
	
}

}

Does Camunda allow external API calls?

@saurabh772 camunda will always allow rest api invocations of microservices

Have you tried in the postman for the rest api you’re trying to access?

Yes I did tested in postman and it is showing the proper response.

Can you post the service delegate class and bpmn model?

1 Like

Thanks for your reply.
Changing the Java Code to :
RestTemplate rest = new RestTemplate();
ResponseEntity response = rest.getForEntity( “https://jsonplaceholder.typicode.com/users”,
String.class);
String processes = response.getBody();
System.out.println(processes);

Solved the problem.