This is Node.js - I get an error 401 - "The request is not from a Connect app." when doing a POST request as follows:
const someMacro = {
dynamicContentMacros: [
{
key: 'somemacro',
name: {
value: 'Some Macro'
},
documentation: {
url: 'https://docs/...'
},
url: '/macro/some/some-macro.html',
bodyType: 'rich-text',
icon: {
width: 72,
height: 72,
url: '/icons/somemacro/somemacro.png'
},
cacheable: true,
description: {
value: 'Some Macro'
}
}
]
};
export async function doSomething(register: any): Promise<any> {
if (!register) {
return null;
}
return window.AP.request({
url: `/rest/atlassian-connect/1/app/module/dynamic`,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(someMacro)
}).catch(err => {
return err;
});
}
Which is as per https://developer.atlassian.com/cloud/confluence/rest/api-group-dynamic-modules/#api-atlassian-connect-1-app-module-dynamic-post
so what's wrong?!
@Paul SRegistering dynamic modules is only allowed for connect applications. If your app is not installed in Confluence Cloud, you can't use that API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.