Can we modify confluence content on a JIRA workflow post-function?

I am using a REST API to get some details from the confluence server but it fails, I’ve posted the code here

I’d appreciate if you can have a look and correct my mistake in the code.

Thanks in advance