0

Get Custom Content States

by
Published Oct 17, 2025

Get custom content states that authenticated user has created. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required** Must have user authentication.

Script confluence
  • Submitted by hugo697 Bun
    Created 284 days ago
    1
    //native
    2
    type Confluence = {
    3
    	email: string
    4
    	apiToken: string
    5
    	domain: string
    6
    }
    7
    /**
    8
     * Get Custom Content States
    9
     * Get custom content states that authenticated user has created.
    10
    
    
    11
    **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**
    12
    Must have user authentication.
    13
     */
    14
    export async function main(auth: Confluence) {
    15
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/content-states`)
    16
    
    
    17
    	const response = await fetch(url, {
    18
    		method: 'GET',
    19
    		headers: {
    20
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    21
    		},
    22
    		body: undefined
    23
    	})
    24
    	if (!response.ok) {
    25
    		const text = await response.text()
    26
    		throw new Error(`${response.status} ${text}`)
    27
    	}
    28
    	return await response.json()
    29
    }
    30