code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/generic.en-us.md (about)

     1  ---
     2  date: "2021-07-20T00:00:00+00:00"
     3  title: "Generic Package Registry"
     4  slug: "generic"
     5  sidebar_position: 40
     6  draft: false
     7  toc: false
     8  menu:
     9    sidebar:
    10      parent: "packages"
    11      name: "Generic"
    12      sidebar_position: 40
    13      identifier: "generic"
    14  ---
    15  
    16  # Generic Package Registry
    17  
    18  Publish generic files, like release binaries or other output, for your user or organization.
    19  
    20  ## Authenticate to the package registry
    21  
    22  To authenticate to the Package Registry, you need to provide [custom HTTP headers or use HTTP Basic authentication](development/api-usage.md#authentication).
    23  
    24  ## Publish a package
    25  
    26  To publish a generic package perform a HTTP PUT operation with the package content in the request body.
    27  You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
    28  
    29  ```
    30  PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
    31  ```
    32  
    33  | Parameter         | Description |
    34  | ----------------- | ----------- |
    35  | `owner`           | The owner of the package. |
    36  | `package_name`    | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
    37  | `package_version` | The package version, a non-empty string without trailing or leading whitespaces. |
    38  | `file_name`       | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
    39  
    40  Example request using HTTP Basic authentication:
    41  
    42  ```shell
    43  curl --user your_username:your_password_or_token \
    44       --upload-file path/to/file.bin \
    45       https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
    46  ```
    47  
    48  If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
    49  
    50  The server responds with the following HTTP Status codes.
    51  
    52  | HTTP Status Code  | Meaning |
    53  | ----------------- | ------- |
    54  | `201 Created`     | The package has been published. |
    55  | `400 Bad Request` | The package name and/or version and/or file name are invalid. |
    56  | `409 Conflict`    | A file with the same name exist already in the package. |
    57  
    58  ## Download a package
    59  
    60  To download a generic package perform a HTTP GET operation.
    61  
    62  ```
    63  GET https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
    64  ```
    65  
    66  | Parameter         | Description |
    67  | ----------------- | ----------- |
    68  | `owner`           | The owner of the package. |
    69  | `package_name`    | The package name. |
    70  | `package_version` | The package version. |
    71  | `file_name`       | The filename. |
    72  
    73  The file content is served in the response body. The response content type is `application/octet-stream`.
    74  
    75  Example request using HTTP Basic authentication:
    76  
    77  ```shell
    78  curl --user your_username:your_token_or_password \
    79       https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
    80  ```
    81  
    82  The server responds with the following HTTP Status codes.
    83  
    84  | HTTP Status Code  | Meaning |
    85  | ----------------- | ------- |
    86  | `200 OK`          | Success |
    87  | `404 Not Found`   | The package or file was not found. |
    88  
    89  ## Delete a package
    90  
    91  To delete a generic package perform a HTTP DELETE operation. This will delete all files of this version.
    92  
    93  ```
    94  DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}
    95  ```
    96  
    97  | Parameter         | Description |
    98  | ----------------- | ----------- |
    99  | `owner`           | The owner of the package. |
   100  | `package_name`    | The package name. |
   101  | `package_version` | The package version. |
   102  
   103  Example request using HTTP Basic authentication:
   104  
   105  ```shell
   106  curl --user your_username:your_token_or_password -X DELETE \
   107       https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0
   108  ```
   109  
   110  The server responds with the following HTTP Status codes.
   111  
   112  | HTTP Status Code  | Meaning |
   113  | ----------------- | ------- |
   114  | `204 No Content`  | Success |
   115  | `404 Not Found`   | The package was not found. |
   116  
   117  ## Delete a package file
   118  
   119  To delete a file of a generic package perform a HTTP DELETE operation. This will delete the package version too if there is no file left.
   120  
   121  ```
   122  DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{filename}
   123  ```
   124  
   125  | Parameter         | Description |
   126  | ----------------- | ----------- |
   127  | `owner`           | The owner of the package. |
   128  | `package_name`    | The package name. |
   129  | `package_version` | The package version. |
   130  | `filename`        | The filename. |
   131  
   132  Example request using HTTP Basic authentication:
   133  
   134  ```shell
   135  curl --user your_username:your_token_or_password -X DELETE \
   136       https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
   137  ```
   138  
   139  The server responds with the following HTTP Status codes.
   140  
   141  | HTTP Status Code  | Meaning |
   142  | ----------------- | ------- |
   143  | `204 No Content`  | Success |
   144  | `404 Not Found`   | The package or file was not found. |