Forge updatePage API doesn't work if I try to insert Jira Link.

Hayata Kobayashi (IBM-Other) January 20, 2025

I am trying to update the confluence page with the following code

 

 

var bodyData = `{
      "id": "${pageId}",
      "status": "current",
      "title": "${pageTitle}",
      "body": {
        "representation": "storage",
        "value": "${pageValue}"
      },
      "version": {
        "number": ${pageVersion},
        "message": "test"
      }
    }`;
    const response = await api.asApp().requestConfluence(route`/wiki/api/v2/pages/${pageId}`, {
      method: 'PUT',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: bodyData
    });

When the pageValue is “<p>test</p>”, the process runs fine, but the following code returns error 400. Please let me know the cause.

Thank you very much for your cooperation.

<ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="637cece6-9706-4a27-b000-f2fd179c1a0e"><ac:parameter ac:name="key">MWAY-303</ac:parameter><ac:parameter ac:name="serverId">303def5a-dfaa-3ae6-bef9-fb20e9237f66</ac:parameter><ac:parameter ac:name="server">System Jira</ac:parameter></ac:structured-macro>

1 answer

1 accepted

0 votes
Answer accepted
Hayata Kobayashi (IBM-Other) January 22, 2025

コードが間違っていました。
下記コードの”を'に変更したら解決しました


<ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="637cece6-9706-4a27-b000-f2fd179c1a0e"><ac:parameter ac:name="key">MWAY-303</ac:parameter><ac:parameter ac:name="serverId">303def5a-dfaa-3ae6-bef9-fb20e9237f66</ac:parameter><ac:parameter ac:name="server">System Jira</ac:parameter></ac:structured-macro>

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events