GitHub Directories API

The Directories API from GitHub — 1 operation(s) for directories.

Documentation

📖
Documentation
https://docs.github.com/en/rest/apps
📖
Documentation
https://docs.github.com/en/rest/codes-of-conduct/codes-of-conduct
📖
Documentation
https://docs.github.com/en/rest/emojis
📖
Documentation
https://docs.github.com/en/rest/gitignore
📖
Documentation
https://docs.github.com/en/rest/apps/installations
📖
Documentation
https://docs.github.com/en/rest/enterprise-admin
📖
Documentation
https://docs.github.com/en/rest/activity/events
📖
Documentation
https://docs.github.com/en/rest/orgs
📖
Documentation
https://docs.github.com/en/rest/rate-limit
📖
Documentation
https://docs.github.com/en/enterprise-cloud@latest/rest/scim
📖
Documentation
https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api
📖
Documentation
https://docs.github.com/en/rest/teams
📖
Documentation
https://docs.github.com/en/rest/meta/meta
📖
Documentation
https://docs.github.com/en/rest/actions
📖
Documentation
https://docs.github.com/en/rest/branches
📖
Documentation
https://docs.github.com/en/rest/code-scanning
📖
Documentation
https://docs.github.com/en/rest/collaborators
📖
Documentation
https://docs.github.com/en/rest/dependabot
📖
Documentation
https://docs.github.com/en/rest/webhooks
📖
Documentation
https://docs.github.com/en/rest/pulls
📖
Documentation
https://docs.github.com/en/rest/git/tags
📖
Documentation
https://docs.github.com/en/rest/repos/autolinks
📖
Documentation
https://docs.github.com/en/rest/collaborators/invitations

Specifications

Other Resources

OpenAPI Specification

github-directories-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 1.1.4
  title: github-repos-api Directories API
  description: 'Use the REST API to create, manage and control the workflow of public and

    private GitHub repositories.'
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  termsOfService: https://docs.github.com/articles/github-terms-of-service
  contact:
    name: Support
    url: https://support.github.com/contact
servers:
- url: '{protocol}://{hostname}'
  variables:
    hostname:
      description: Self-hosted Enterprise Server hostname
      default: api.github.com
    protocol:
      description: Self-hosted Enterprise Server protocol
      default: https
tags:
- name: Directories
paths:
  /repos/{owner}/{repo}/readme/{dir}:
    get:
      summary: GitHub Get Repository Readme for Directory
      description: 'Gets the README from a repository directory.


        This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."


        - **`application/vnd.github.raw+json`**: Returns the raw file contents. This is the default if you do not specify a media type.

        - **`application/vnd.github.html+json`**: Returns the README in HTML. Markup languages are rendered to HTML using GitHub''s open-source [Markup library](https://github.com/github/markup).'
      tags:
      - Directories
      operationId: getRepositoryReadmeForDirectory
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/repos/contents#get-a-repository-readme-for-a-directory
      parameters:
      - $ref: '#/components/parameters/owner'
      - $ref: '#/components/parameters/repo'
      - name: dir
        description: The alternate path to look for a README file
        in: path
        required: true
        schema:
          type: string
        x-multi-segment: true
        example: example_value
      - name: ref
        description: 'The name of the commit/branch/tag. Default: the repositorys default branch.'
        in: query
        required: false
        schema:
          type: string
        example: main
      - in: header
        name: Authorization
        schema:
          type: string
        example: example_value
      - in: header
        name: X-GitHub-Api-Version
        schema:
          type: string
          default: '2022-11-28'
        example: example_value
      - in: header
        name: Accept
        schema:
          type: string
          default: application/vnd.github+json
        example: example_value
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/content-file'
              examples:
                default:
                  $ref: '#/components/examples/content-file'
        '404':
          $ref: '#/components/responses/not_found'
        '422':
          $ref: '#/components/responses/validation_failed'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: repos
        subcategory: contents
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    content-file:
      title: Content File
      description: Content File
      type: object
      properties:
        type:
          type: string
          enum:
          - file
          example: file
        encoding:
          type: string
          example: example_value
        size:
          type: integer
          example: 42
        name:
          type: string
          example: octocat
        path:
          type: string
          example: src/index.js
        content:
          type: string
          example: example_value
        sha:
          type: string
          example: abc123def456789012345678901234567890
        url:
          type: string
          format: uri
          example: https://api.github.com/repos/octocat/Hello-World
        git_url:
          type: string
          format: uri
          example: https://api.github.com/repos/octocat/Hello-World
        html_url:
          type: string
          format: uri
          example: https://api.github.com/repos/octocat/Hello-World
        download_url:
          type: string
          format: uri
          example: https://api.github.com/repos/octocat/Hello-World
        _links:
          type: object
          properties:
            git:
              type: string
              format: uri
            html:
              type: string
              format: uri
            self:
              type: string
              format: uri
          required:
          - git
          - html
          - self
        target:
          type: string
          example: '"actual/actual.md"'
        submodule_git_url:
          type: string
          example: '"git://example.com/defunkt/dotjs.git"'
      required:
      - _links
      - git_url
      - html_url
      - download_url
      - name
      - path
      - sha
      - size
      - type
      - url
      - content
      - encoding
    validation-error:
      title: Validation Error
      description: Validation Error
      type: object
      required:
      - message
      - documentation_url
      properties:
        message:
          type: string
          example: Example body text
        documentation_url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        errors:
          type: array
          items:
            type: object
            required:
            - code
            properties:
              resource:
                type: string
              field:
                type: string
              message:
                type: string
              code:
                type: string
              index:
                type: integer
              value:
                oneOf:
                - type: string
                - type: integer
                - type: array
                  items:
                    type: string
    basic-error:
      title: Basic Error
      description: Basic Error
      type: object
      properties:
        message:
          type: string
          example: Example body text
        documentation_url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        url:
          type: string
          example: https://api.github.com/repos/octocat/Hello-World
        status:
          type: string
          example: open
  examples:
    content-file:
      value:
        type: file
        encoding: base64
        size: 5362
        name: README.md
        path: README.md
        content: encoded content ...
        sha: 3d21ec53a331a6f037a91c368710b99387d012c1
        url: https://api.github.com/repos/octokit/octokit.rb/contents/README.md
        git_url: https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1
        html_url: https://github.com/octokit/octokit.rb/blob/master/README.md
        download_url: https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md
        _links:
          git: https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1
          self: https://api.github.com/repos/octokit/octokit.rb/contents/README.md
          html: https://github.com/octokit/octokit.rb/blob/master/README.md
  responses:
    validation_failed:
      description: Validation failed, or the endpoint has been spammed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/validation-error'
    not_found:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/basic-error'
  parameters:
    owner:
      name: owner
      description: The account owner of the repository. The name is not case sensitive.
      in: path
      required: true
      schema:
        type: string
    repo:
      name: repo
      description: The name of the repository without the `.git` extension. The name is not case sensitive.
      in: path
      required: true
      schema:
        type: string
  securitySchemes:
    bearerHttpAuthentication:
      description: Bearer Token
      type: http
      scheme: Bearer
externalDocs:
  description: GitHub Enterprise Developer Docs
  url: https://docs.github.com/enterprise-server@3.9/rest/