I am looking for a way to store configration data (simple key.value pairs) in Confluence Cloud app. So I've found this: https://developer.atlassian.com/cloud/confluence/app-properties-api/
I am writing a expressjs app and added the following snippet into my index.js
app.get('/random-page-admin', addon.authenticate(), function (req, res) {
var userKey = req.query['user_key'];
var clientKey = req.context.clientKey;
getHTTPClient(clientKey, userKey).put(
'/rest/atlassian-connect/1/addons/random-page-cloud/properties/pages-limit',
function (err, response, contents) {
if (err || (response.statusCode < 200 || response.statusCode > 299)) {
res.render('<strong>An error has occurred
' + response.statusCode + '</strong>');
return;
}
contents = JSON.parse(contents);
res.render('admin/random-page-admin', {});
}
);
});
Result:
{"status-code":404,"message":"Add-on with key does not exist."}