|
| 1 | +--- |
| 2 | +title: README Uri Template, NuGet API |
| 3 | +description: The README uri template allows clients to download the readme for a package, if available. |
| 4 | +author: jgonz120 |
| 5 | +ms.author: jongonza |
| 6 | +ms.date: 1/6/2025 |
| 7 | +ms.topic: reference |
| 8 | +ms.reviewer: |
| 9 | +--- |
| 10 | + |
| 11 | +# README Uri Template |
| 12 | + |
| 13 | +It is possible for a client to build a URL that can be used to download a README for a specific package. |
| 14 | +This will enable the clients to render the package's README without downloading the entire package. |
| 15 | + |
| 16 | +The resource used for building this URL is the `ReadmeUriTemplate` resource found in the |
| 17 | +[service index](service-index.md). |
| 18 | + |
| 19 | +## Versioning |
| 20 | + |
| 21 | +The following `@type` values are used: |
| 22 | + |
| 23 | +@type value | Notes |
| 24 | +--------------------------------- | ----- |
| 25 | +ReadmeUriTemplate/6.13.0 | The initial release |
| 26 | + |
| 27 | +## URL template |
| 28 | + |
| 29 | +The URL for the following API is the value of the `@id` property associated with one of the aforementioned |
| 30 | +resource `@type` values. |
| 31 | + |
| 32 | +## HTTP methods |
| 33 | + |
| 34 | +The constructed URL must support the HTTP method `GET` |
| 35 | + |
| 36 | +## Construct the URL |
| 37 | + |
| 38 | +Given a known package ID and version, the client implementation can construct a URL to download the README. |
| 39 | + |
| 40 | +The value of the `@id` is a URL string containing any of the following placeholder tokens: |
| 41 | + |
| 42 | +### URL placeholders |
| 43 | + |
| 44 | +Name | Type | Required | Notes |
| 45 | +----------- | ------- | -------- | ----- |
| 46 | +`{lower_id}` | string | yes | The package ID, lowercased |
| 47 | +`{lower_version}` | string | yes | The package version, lowercased |
| 48 | + |
| 49 | +Both `lower_id` and `lower_version` are lowercased using the rules implemented by .NET's |
| 50 | +[`System.String.ToLowerInvariant()`](/dotnet/api/system.string.tolowerinvariant?view=netstandard-2.0#System_String_ToLowerInvariant&preserve-view=true) |
| 51 | +method. |
| 52 | + |
| 53 | +The `lower_version` is the desired package version normalized using NuGet's version |
| 54 | +[normalization rules](../concepts/package-versioning.md#normalized-version-numbers). This means that build metadata |
| 55 | +that is allowed by the SemVer 2.0.0 specification must be excluded in this case. |
| 56 | + |
| 57 | +### Response body |
| 58 | + |
| 59 | +If the package has a readme, a 200 status code is returned. The response body will be the readme |
| 60 | +content itself. |
| 61 | + |
| 62 | +If the package does not have a readme, a 404 status code is returned. |
0 commit comments