Updating confluence page with HTML markup

Describe the problem/error/question

On the final node in the flow listed above, update confluence, its a http node using the following in the body:

{ "id": "{{ $json.resolvedPayload.id }}", "type": "{{ $json.resolvedPayload.type }}", "title": "{{ $json.resolvedPayload.title }}", "space": { "key": "{{ $json.resolvedPayload.space.key }}" }, "version": { "number": "{{ $json.incrementFields.newVersion }}" }, "body": { "storage": { "value": "{{ $('Format Data').item.json.confluenceBody }} {{ $json.incrementFields.newVersion }}", "representation": "storage" } } } 

What is the error message (if any)?

Everything works great, except for {{ $('Format Data').item.json.confluenceBody }} when I include that expression I get { "id": "680716237", "type": "page", "title": "Test Title", "space": { "key": "~ValidData" }, "version": { "number": "29" }, "body": { "storage": { "value": "[object Object] 29", "representation": "storage" } } }

Hello @n8n.6h82t

"[object Object] 29" means your value for $('Format Data').item.json.confluenceBody is an Object and not a string. So you should convert it to string or extract the field your need

Thanks for your feedback! When I do that in the previous function node that leads to the following error in the ‘update contluence’ node

> Can not instantiate value of type [simple type, class com.atlassian.confluence.api.model.content.Content] from JSON String; no single-String constructor/factory method```

Can you provide the content of the $('Format Data').item.json.confluenceBody variable?

I had to edit out the data, but hopefully this is enough for you

“formatData”: {
“confluenceBody”: “{"storage":{"value":"\n

Jira Issues Report

\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n
KeySummaryStatusUpdatedLast Comment
validvalid In Progressvalidvalid
\n","representation":"storage"}}”
}

The portal here is transforming the html markup that is inside the value

replace the evaluation with { "id": "{{ $json.resolvedPayload.id }}", "type": "{{ $json.resolvedPayload.type }}", "title": "{{ $json.resolvedPayload.title }}", "space": { "key": "{{ $json.resolvedPayload.space.key }}" }, "version": { "number": "{{ $json.incrementFields.newVersion }}" }, "body": { "storage": { "value": {{ JSON.stringify($('Format Data').item.json.confluenceBody.storage.value + String($json.incrementFields.newVersion)) }}, "representation": "storage" } } }

Sorry, I am not sure I understand. This results in

Bad request - please check your parameters

Can not instantiate value of type [simple type, class com.atlassian.confluence.api.model.content.Content] from JSON String; no single-String constructor/factory method

Please, share the workflow.

You can select all nodes with ctrl+a, copy it with ctrl+c. Then past the content here after pressing button </> with ctrl+v.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.