简体   繁体   English

从 Bitbucket 检索文本文件内容

[英]Retrieve Text file content from Bitbucket

I want to Read the text file which is uploaded in BitBucket through REST Api.我想阅读在 BitBucket 到 REST Api 中上传的文本文件。

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

This gives JSON of folder content.这给出了文件夹内容的 JSON。 I wanted to read text file and to extract the content.我想阅读文本文件并提取内容。 How to do it?怎么做?

In term of API, make sure to not use the V1, which is deprecated for BitBucket .在 API 方面,确保不要使用V1,它已被 BitBucket 弃用

One API endpoint which returns the content of a file would then be /2.0/repositories/{workspace}/{repo_slug}/src一个返回文件内容的 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).如果路径与文件匹配,则返回文件的原始内容(除非提供了 format=meta 查询参数,在这种情况下,将返回包含文件元数据的 json 文档)。

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).如果路径与目录匹配,则返回文件和目录条目的分页列表(如果提供了 format=meta 查询参数,则返回包含目录元数据的 json 文档)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM