//native
type Confluence = {
email: string
apiToken: string
domain: string
}
/**
* Update space settings
* Updates the settings for a space. Currently only the
`routeOverrideEnabled` setting can be updated.
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
'Admin' permission for the space.
*/
export async function main(
auth: Confluence,
spaceKey: string,
body: { routeOverrideEnabled?: false | true }
) {
const url = new URL(`https://${auth.domain}/wiki/rest/api/space/${spaceKey}/settings`)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago