json - 从 Bitbucket 中检索文本文件内容

标签 json rest bitbucket bitbucket-api

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

网址:https://{用户名}:{token}/bitbucket.org/rest/api/1.0/{path}。

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

最佳答案

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

一个返回文件内容的 API 端点将是 /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).

关于json - 从 Bitbucket 中检索文本文件内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62275406/

相关文章:

json - 如何在Go中解析json?

linux - linux 平台上的 JSON 服务器建议

Python urllib.urlopen() 调用不适用于浏览器接受的 URL

git - 将提交历史记录从几个 github 存储库移至一个 bitbucket 存储库

javascript - 使用 Javascript 读取从 REST API 返回的 JSON 数据

java - 带有状态代码的非 Jersey JAX-RS 自定义异常

python - 如何使用python urllib2发送json数据进行登录

rest - 如何从restTemplate交换方法获取通用 map 作为响应?

java - 如果请求参数超过 15 个,POST 或 GET 应该使用什么?

Git pull 不会 pull 下最近的提交