Hi there,
I'm attempting to download a repository's contents in a Forge resolver.
To accomplish this, I'm trying to call the the repository archive endpoint, as documented on this Bitbucket Cloud knowledge base page:
https://bitbucket.org/<workspace-name>/<repo>/get/<branch>.<zip|gz|bz2>
However when running the the following code:
const response = await api
.asApp()
.requestBitbucket(
routeFromAbsolute(
`https://bitbucket.org/${workspaceId}/${slug}/get/master.zip`
)
);
this error is thrown:
PROXY_ERR: Forge platform failed to process runtime HTTP request - 400 - INVALID_TARGET_URL
at handleProxyResponseErrors (webpack://bitbucket-repository-main-menu-page-ui-kit-2/node_modules/@forge/api/out/api/fetch.js:27:1)
at <anonymous> (webpack://bitbucket-repository-main-menu-page-ui-kit-2/node_modules/@forge/api/out/api/fetch.js:15:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 400,
errorCode: 'INVALID_TARGET_URL'
}
Is it possible to use this endpoint to retrieve the repository contents as a zip file when using Forge?
Otherwise is there a recommended alternative endpoint that could be used? As noted here it's not possible to use the List Download Artifacts endpoint because only manually-uploaded files are returned there from the API, and not the "Download repository" item as listed in the UI.