从 Bitbucket 中检索文本文件内容

Retrieve Text file content from Bitbucket

我想通过 REST 读取在 BitBucket 中上传的文本文件 Api。

URL: https://{用户名}:{token}/bitbucket.org/rest/api/1.0/{路径}.

这给出了 JSON 的文件夹内容。我想阅读文本文件并提取内容。怎么做?

在 API 方面,确保不要使用 V1, which is deprecated for BitBucket

一个 API 端点,returns 文件的内容将是 /2.0/repositories/{workspace}/{repo_slug}/src

If the path matches a file, then the raw contents of the file are returned (unless the format=meta query parameter was provided, in which case a json document containing the file's meta data is returned).

If the path matches a directory, then a paginated list of file and directory entries is returned (if the format=meta query parameter was provided, then the json document containing the directory's meta data is returned).