@managed-api/confluence-cloud-v2-core
v2.1.0
Published
Adaptavist Managed API for Confluence Cloud v2
Downloads
100
Keywords
Readme
Managed API for Confluence Cloud
Managed API for Confluence Cloud is an API Client for Confluence Cloud by Adaptavist primarily designed for the use in ScriptRunner Connect. You can read more about Managed APIs here.
This is a runtime agnostic version of the Managed API (with core
suffix) that makes it easy to port it to any runtime you may want to use this Managed API on.
Platform specific ports
Supported API calls
- fetch
- Ancestor
- Attachment
- deleteAttachment
- getAttachmentById
- getAttachments
- BlogPost
- CustomContent
- Label
- Page
- BlogPost
- Children
- Comment
- Attachment
- CustomContent
- Footer
- Inline
- Content
- convertIdsToTypes
- Property
- Attachment
- BlogPost
- Comment
- CustomContent
- Page
- Whiteboard
- CustomContent
- Label
- Like
- Page
- Space
- Task
- V1
- Content
- publishLegacyDraft
- publishSharedDraft
- searchContentByCQL
- Attachment
- Body
- Copy
- Descendant
- Label
- Move
- Restriction
- Version
- Label
- LongRunningTask
- Relation
- Search
- Setting
- Space
- Template
- Theme
- User
- UserGroup
- Watcher
- Content
- Version
- Attachment
- BlogPost
- Comment
- CustomContent
- Page
- Whiteboard
Porting to other runtimes
While the primary reason for creating Managed APIs was to use them in ScriptRunner Connect runtime, then you can easily port them to any runtime of your choosing.
You can do so by extending the *Core
Managed API class where you'll be asked to provide implementation for getPlatformImplementation
function. In this implementation you have to specify how to perform buffer encoding/decoding operations and how to perform HTTP calls:
{
buffer: {
encode(input: string): ArrayBuffer;
decode(input: ArrayBuffer): string;
},
performHttpCall(request: Request): Promise<Response>
}
Here is an example how to create a Node port of the Managed API:
import { ConfluenceCloudApiCore } from "@managed-api/confluence-cloud-v2-core";
import { PlatformImplementation, Request, Response, Headers } from "@managed-api/commons-core";
import fetch from "node-fetch";
export class ConfluenceCloudApi extends ConfluenceCloudApiCore {
constructor(private baseUrl: string, private authToken: string) {
super();
}
protected getPlatformImplementation(): PlatformImplementation {
return {
buffer: {
encode: (input) => Buffer.from(input, 'utf-8'),
decode: (input) => Buffer.from(input).toString('utf-8')
},
performHttpCall: (request) => this.performHttpCall(request)
};
}
private async performHttpCall(request: Request): Promise<Response> {
const requestUrl = `${this.baseUrl}${request.url}`; // Substitute base URL
request.headers.set('Authorization', `Basic ${this.authToken}`); // Substitute auth token
const response = await fetch(requestUrl, {
method: request.method,
headers: request.headers as any,
body: request.method.toLowerCase() !== 'get' ? Buffer.from((await request.arrayBuffer()) ?? new ArrayBuffer(0)) : undefined
});
const apiHeaders = new Headers();
response.headers.forEach((value, key) => apiHeaders.append(key, value));
const body = await response.arrayBuffer();
return super.buildResponse(response.url, response.status, response.statusText, apiHeaders, body);
}
}
Please note that the authentication handling details may not be accurate and serve as an example. If you wish to use these Managed APIs without having to concern yourself how to deal with and secure authentication details when working with APIs, then feel free to evaluate ScriptRunner Connect platform.
Contact
At this time Managed APIs are unlicensed and close sourced, but feel free to drop an email to [email protected] for ideas, suggestions and improvements.
Changelog
2.1.0
Updated OpenApi Specification.
- Added new fields
include-labels
,include-properties
,include-operations
,include-versions
andinclude-version
toAttachment.getAttachmentById
. - Added new field
purge
toAttachment.deleteAttachment
. - Added new field
purge
toCustomContent.deleteCustomContent
. - Added new field
version
toComment.Attachment.getComments
. - Added new fields
include-labels
,include-properties
,include-operations
,include-versions
,include-version
andinclude-favorited-by-current-user-status
toCustomContent.getCustomContentById
. - Added new fields
draft
andpurge
toBlogPost.deleteBlogPost
. - Added new fields
draft
andpurge
toPage.deletePage
. - Added new field
root-level
toPage.createPage
. - Added new fields
include-labels
,include-properties
,include-operations
,include-versions
,include-version
,include-likes
, andinclude-favorited-by-current-user-status
toPage.getPageById
. - Added new fields
favorited-by
andnot-favorited-by
toSpace.getSpaces
. - Added new fields
include-labels
,include-properties
,include-operations
andinclude-permissions
toSpace.getSpaceById
. - Added new fields
include-properties
,include-operations
,include-versions
,include-version
andinclude-likes
toComment.Footer.getCommentById
. - Added new fields
include-properties
,include-operations
,include-versions
,include-version
andinclude-likes
toComment.Inline.getCommentById
. - Added new field
body-format
toTask.updateTask
. - Removed
deleted
fromstatus
inBlogPost.updateBlogPost
. - Added new field
ownerId
toPage.updatePage
. Attachment
definition got changed toAttachmentSingle
.- New properties in
PageSingle
definition. - New properties in
PageBulk
definition.
- Added new fields
Added support for the following Comment.CustomContent method:
- Get custom content comments that can be used as
Comment.CustomContent.getComments
orAll.getCustomContentComments
.
- Get custom content comments that can be used as
Added support for the following Whiteboard methods:
- Create whiteboard that can be used as
Whiteboard.createWhiteboard
orAll.getWhiteboard
. - Get whiteboard by id that can be used as
Whiteboard.getWhiteboardById
orAll.getWhiteboardById
. - Delete whiteboard that can be used as
Whiteboard.deleteWhiteboard
orAll.deleteWhiteboard
.
- Create whiteboard that can be used as
Added support for the following Content.Property.Whiteboard methods:
- Get content properties for whiteboard that can be used as
Content.Property.Whiteboard.getContentProperties
orAll.getContentPropertiesForWhiteboard
. - Create content property for whiteboard that can be used as
Content.Property.Whiteboard.createContentProperty
orAll.createContentPropertyForWhiteboard
. - Get content property for whiteboard by id that can be used as
Content.Property.Whiteboard.getContentPropertyById
orAll.getContentPropertyForWhiteboardById
. - Update content property for whiteboard by id that can be used as
Content.Property.Whiteboard.updateContentPropertyById
orAll.updateContentPropertyForWhiteboardById
. - Delete content property for whiteboard by id that can be used as
Content.Property.Whiteboard.deleteContentPropertyById
orAll.deleteContentPropertyForWhiteboardById
.
- Get content properties for whiteboard that can be used as
Added support for the following Ancestor method:
- Get all ancestors of the whiteboard that can be used as
Ancestor.getAllAncestorsOfWhiteboard
orAll.getAllAncestorsOfWhiteboard
.
- Get all ancestors of the whiteboard that can be used as
Fixed following methods:
- Get footer comments that can be used as
Comment.Footer.getComments
orAll.getFooterComments
. - updateComment that can be used as
Comment.Footer.updateComment
orAll.updateFooterComment
. - deleteComment that can be used as
Comment.Footer.deleteComment
orAll.deleteFooterComment
. - getCommentById that can be used as
Comment.Inline.getCommentById
orAll.getInlineCommentById
. - updateComment that can be used as
Comment.Inline.updateComment
orAll.updateInlineComment
. - deleteComment that can be used as
Comment.Inline.deleteComment
orAll.deleteInlineComment
.
- Get footer comments that can be used as
The following methods are deprecated:
- Get content restriction status for group that can be used as
V1.Content.Restriction.Group.getGroupStatus
orAll.getContentRestrictionGroupStatus
. - Add group to content restriction that can be used as
V1.Content.Restriction.Group.addGroup
orAll.addContentRestrictionGroup
. - Remove group from content restriction that can be used as
V1.Content.Restriction.Group.removeGroup
orAll.removeContentRestrictionGroup
.
- Get content restriction status for group that can be used as
2.0.0
Breaking change: URL and query string parameters are now URL encoded, meaning if you encoded them explicitly before you have to remove your own encoding, otherwise they will get double encoded.
1.0.0
Added support for the following Attachment methods:
- Get attachments that can be used as
Attachment.getAttachments
orAll.getAttachments
. - Get attachment by id that can be used as
Attachment.getAttachmentById
orAll.getAttachmentByIds
. - Delete attachment that can be used as
Attachment.deleteAttachment
orAll.deleteAttachment
.
- Get attachments that can be used as
Added support for the following Attachment.BlogPost method:
- Get attachments for blog post that can be used as
Attachment.BlogPost.getAttachments
orAll.getAttachmentsForBlogPost
.
- Get attachments for blog post that can be used as
Added support for the following Attachment.CustomContent method:
- Get attachments for custom content that can be used as
Attachment.CustomContent.getAttachments
orAll.getAttachmentsForCustomContent
.
- Get attachments for custom content that can be used as
Added support for the following Attachment.Label method:
- Get attachments for label that can be used as
Attachment.Label.getAttachments
orAll.getAttachmentsForLabel
.
- Get attachments for label that can be used as
Added support for the following Attachment.Page method:
- Get attachments for page that can be used as
Attachment.Page.getAttachments
orAll.getAttachmentsForPage
.
- Get attachments for page that can be used as
Added support for the following Ancestor method:
- Get all ancestors of page that can be used as
Ancestor.getAllAncestorsOfPage
orAll.getAllAncestorsOfPage
.
- Get all ancestors of page that can be used as
Added support for the following BlogPost methods:
- Get blog posts that can be used as
BlogPost.getBlogPosts
orAll.getBlogPosts
. - Create blog post that can be used as
BlogPost.createBlogPost
orAll.createBlogPost
. - Get blog post by id that can be used as
BlogPost.getBlogPostById
orAll.getBlogPostById
. - Update blog post that can be used as
BlogPost.updateBlogPost
orAll.updateBlogPost
. - Delete blog post that can be used as
BlogPost.deleteBlogPost
orAll.deleteBlogPost
. - Get blog posts for label that can be used as
BlogPost.getBlogPostsForLabel
orAll.getBlogPostsForLabel
. - Get blog posts in space that can be used as
BlogPost.getBlogPostsInSpace
orAll.getBlogPostsInSpace
.
- Get blog posts that can be used as
Added support for the following Children methods:
- Get child pages that can be used as
Children.getChildPages
orAll.getChildPages
. - Get child custom content that can be used as
Children.getChildCustomContent
orAll.getChildCustomContent
.
- Get child pages that can be used as
Added support for the following Comment.Attachment method:
- Get attachment comments that can be used as
Comment.Attachment.getComments
orAll.getAttachmentComments
.
- Get attachment comments that can be used as
Added support for the following Comment.Footer.Page method:
- Get footer comments for page that can be used as
Comment.Footer.Page.getComments
orAll.getFooterCommentsForPage
.
- Get footer comments for page that can be used as
Added support for the following Comment.Inline.Page method:
- Get inline comments for page that can be used as
Comment.Inline.Page.getComments
orAll.getInlineCommentsForPage
.
- Get inline comments for page that can be used as
Added support for the following Comment.Footer.BlogPost method:
- Get footer comments for blog post that can be used as
Comment.Footer.BlogPost.getComments
orAll.getFooterCommentsForBlogPost
.
- Get footer comments for blog post that can be used as
Added support for the following Comment.Inline.BlogPost method:
- Get inline comments for blog post that can be used as
Comment.Inline.BlogPost.getComments
orAll.getInlineCommentsForFooter
.
- Get inline comments for blog post that can be used as
Added support for the following Comment.Footer methods:
- Get footer comments that can be used as
Comment.Footer.getComments
orAll.getFooterComments
. - Create footer comment that can be used as
Comment.Footer.createComment
orAll.createFooterComment
. - getCommentById that can be used as
Comment.Footer.getCommentById
orAll.getFooterCommentById
. - updateComment that can be used as
Comment.Footer.updateComment
orAll.updateFooterComment
. - deleteComment that can be used as
Comment.Footer.deleteComment
orAll.deleteFooterComment
. - Get children footer comments that can be used as
Comment.Footer.getChildrenComments
orAll.getChildrenFooterComments
.
- Get footer comments that can be used as
Added support for the following Comment.Inline methods:
- Get inline comments that can be used as
Comment.Inline.getComments
orAll.getInlineComments
. - Create inline comment that can be used as
Comment.Inline.createComment
orAll.createInlineComment
. - getCommentById that can be used as
Comment.Inline.getCommentById
orAll.getInlineCommentById
. - updateComment that can be used as
Comment.Inline.updateComment
orAll.updateInlineComment
. - deleteComment that can be used as
Comment.Inline.deleteComment
orAll.deleteInlineComment
. - Get children inline comments that can be used as
Comment.Inline.getChildrenComments
orAll.getChildrenInlineComments
.
- Get inline comments that can be used as
Added support for the following Content method:
- Convert content ids to content types that can be used as
Content.convertIdsToTypes
orAll.convertContentIdsToContentType
.
- Convert content ids to content types that can be used as
Added support for the following Content.Property.Attachment methods:
- Get content properties for attachment that can be used as
Content.Property.Attachment.getContentProperties
orAll.getContentPropertiesForAttachment
. - Create content property for attachment that can be used as
Content.Property.Attachment.createContentProperty
orAll.createContentPropertyForAttachment
. - Get content property for attachment by id that can be used as
Content.Property.Attachment.getContentPropertyById
orAll.getContentPropertyForAttachmentById
. - Update content property for attachment by id that can be used as
Content.Property.Attachment.updateContentPropertyById
orAll.updateContentPropertyForAttachmentById
. - Delete content property for attachment by id that can be used as
Content.Property.Attachment.deleteContentPropertyById
orAll.deleteContentPropertyForAttachmentById
.
- Get content properties for attachment that can be used as
Added support for the following Content.Property.BlogPost methods:
- Get content properties for blog post that can be used as
Content.Property.BlogPost.getContentProperties
orAll.getContentPropertiesForBlogPost
. - Create content property for blog post that can be used as
Content.Property.BlogPost.createContentProperty
orAll.createContentPropertyForBlogPost
. - Get content property for blog post by id that can be used as
Content.Property.BlogPost.getContentPropertyById
orAll.getContentPropertyForBlogPostById
. - Update content property for blog post by id that can be used as
Content.Property.BlogPost.updateContentPropertyById
orAll.updateContentPropertyForBlogPostById
. - Delete content property for blogpost by id that can be used as
Content.Property.BlogPost.deleteContentPropertyById
orAll.deleteContentPropertyForBlogPostById
.
- Get content properties for blog post that can be used as
Added support for the following Content.Property.CustomContent methods:
- Get content properties for custom content that can be used as
Content.Property.CustomContent.getContentProperties
orAll.getContentPropertiesForCustomContent
. - Create content property for custom content that can be used as
Content.Property.CustomContent.createContentProperty
orAll.createContentPropertyForCustomContent
. - Get content property for custom content by id that can be used as
Content.Property.CustomContent.getContentPropertyById
orAll.getContentPropertyForCustomContentById
. - Update content property for custom content by id that can be used as
Content.Property.CustomContent.updateContentPropertyById
orAll.updateContentPropertyById
. - Delete content property for custom content by id that can be used as
Content.Property.CustomContent.deleteContentPropertyById
orAll.deleteContentPropertyForCustomContentById
.
- Get content properties for custom content that can be used as
Added support for the following Content.Property.Page methods:
- Get content properties for page that can be used as
Content.Property.Page.getContentProperties
orAll.getContentPropertiesForPage
. - Create content property for page that can be used as
Content.Property.Page.createContentProperty
orAll.createContentPropertyForPage
. - Get content property for page by id that can be used as
Content.Property.Page.getContentPropertyById
orAll.getContentPropertyForPageById
. - Update content property for page by id that can be used as
Content.Property.Page.updateContentPropertyById
orAll.updateContentPropertyForPageById
. - Delete content property for page by id that can be used as
Content.Property.Page.deleteContentPropertyById
orAll.deleteContentPropertyForPageById
.
- Get content properties for page that can be used as
Added support for the following Content.Property.Comment methods:
- Get content properties for comment that can be used as
Content.Property.Comment.getContentProperties
orAll.getContentPropertiesForComment
. - Create content property for comment that can be used as
Content.Property.Comment.createContentProperty
orAll.createContentPropertyForComment
. - Get content property for comment by id that can be used as
Content.Property.Comment.getContentPropertyById
orAll.getContentPropertyForCommentById
. - Update content property for comment by id that can be used as
Content.Property.Comment.updateContentPropertyById
orAll.updateContentPropertyForCommentById
. - Delete content property for comment by id that can be used as
Content.Property.Comment.deleteContentPropertyById
orAll.deleteContentPropertyForCommentById
.
- Get content properties for comment that can be used as
Added support for the following CustomContent.BlogPost method:
- Get custom content by type in blog post that can be used as
CustomContent.BlogPost.getCustomContentByType
orAll.getCustomContentByTypeInBlogPost
.
- Get custom content by type in blog post that can be used as
Added support for the following CustomContent methods:
- Get custom content by type that can be used as
CustomContent.getCustomContentByType
orAll.getCustomContentByType
. - Create custom content that can be used as
CustomContent.createCustomContent
orAll.createCustomContent
. - Get custom content by id that can be used as
CustomContent.getCustomContentById
orAll.getCustomContentById
. - Update custom content that can be used as
CustomContent.updateCustomContent
orAll.updateCustomContent
. - Delete custom content that can be used as
CustomContent.deleteCustomContent
orAll.deleteCustomContent
.
- Get custom content by type that can be used as
Added support for the following CustomContent.Page method:
- Get custom content by type in page that can be used as
CustomContent.Page.getCustomContentByType
orAll.getCustomContentByTypeInPage
.
- Get custom content by type in page that can be used as
Added support for the following CustomContent.Space method:
- Get custom content by type in space that can be used as
CustomContent.Space.getCustomContentByType
orAll.getCustomContentByTypeInSpace
.
- Get custom content by type in space that can be used as
Added support for the following Label.Attachment method:
- Get labels for attachment that can be used as
Label.Attachment.getLabels
orAll.getLabelsForAttachment
.
- Get labels for attachment that can be used as
Added support for the following Label.BlogPost method:
- Get labels for blog post that can be used as
Label.BlogPost.getLabels
orAll.getLabelsForBlogPost
.
- Get labels for blog post that can be used as
Added support for the following Label.CustomContent method:
- Get labels for custom content that can be used as
Label.CustomContent.getLabels
orAll.getLabelsForCustomContent
.
- Get labels for custom content that can be used as
Added support for the following Label.Page method:
- Get labels for page that can be used as
Label.Page.getLabels
orAll.getLabelsForPage
.
- Get labels for page that can be used as
Added support for the following Label method:
- Get labels that can be used as
Label.getLabels
orAll.getLabels
.
- Get labels that can be used as
Added support for the following Label.Space methods:
- Get labels for space that can be used as
Label.Space.getLabels
orAll.getLabelsForSpace
. - Get labels for space content that can be used as
Label.Space.getLabelsForContent
orAll.getLabelsForSpaceContent
.
- Get labels for space that can be used as
Added support for the following Like.BlogPost methods:
- Get like count for blog post that can be used as
Like.BlogPost.getLikeCount
orAll.getLikeCountForBlogPost
. - Get account IDs of likes for blog post that can be used as
Like.BlogPost.getAccountIdsOfLikes
orAll.getAccountIdsOfLikesForBlogPost
.
- Get like count for blog post that can be used as
Added support for the following Like.Page methods:
- Get like count for page that can be used as
Like.Page.getLikeCount
orAll.getLikeCountForPage
. - [Get
- Get like count for page that can be used as