Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a space-level custom content type in Confluence space?

Asmaa Hadir
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 18, 2023

I am creating a keyword directory-like feature in my Confluence cloud app and I would like to create a custom content `keyword` to be rendered as part of the space custom content list view. How can I do this in Forge? I have already written the following code to create the custom content but I am not sure how to proceed...:
`

export const createKeyWordCustomContent = async  (type, spaceKey, pageId, keywordValue) => {
 
    const spaceId = await getSpaceIdByKey(spaceKey);
 
    var bodyData = `{
      "type": ${type},
      "spaceId": ${spaceId},
      "pageId": ${pageId},
      "title": "Keyword",
      "body": {
        "representation": "storage",
        "value": ${keywordValue}
      }
    }`;
   
    const response = await api.asUser().requestConfluence(route`/wiki/api/v2/custom-content`, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: bodyData
    });
   
    console.log(`Response: ${response.status} ${response.statusText}`);
    console.log(await response.json());
 
    // postcondition: keyword custom content type created
 
    // update the keyword value
 
 
 
 
  }`
Any leads would be great. Thank you :)
 

0 answers

Suggest an answer

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

Atlassian Community Events