How to access source code files and list directories using GitLab API?

后端 未结 1 1823
一向
一向 2021-02-06 15:00

I am using GitLab and I completed setup as described in Gitlab installation instructions, I am now trying to access its RestFul API to perform tasks like create/delete Projects

1条回答
  •  失恋的感觉
    2021-02-06 15:34

    I am assuming that project snippets refer to source code files or any other files within the project

    No, you can see snippets in the GitLab demo project: diaspora snippets.
    They are in a separate tabs than the "Files" tab.
    They would be the equivalent of GitHub gist.

    Have a look at the repository API, like:

    List repository tree

    Get a list of repository files and directories in a project.

    GET /projects/:id/repository/tree
    

    Raw blob content

    Get the raw file contents for a file.

    GET /projects/:id/repository/commits/:sha/blob
    

    astratto mentions that the new API (6.x) requires that a filepath is appended:

    GET /projects/:id/repository/blobs/:sha?filepath=:filepath
    

    0 讨论(0)
提交回复
热议问题