RESTween.Core 1.7.10

dotnet add package RESTween.Core --version 1.7.10
                    
NuGet\Install-Package RESTween.Core -Version 1.7.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RESTween.Core" Version="1.7.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RESTween.Core" Version="1.7.10" />
                    
Directory.Packages.props
<PackageReference Include="RESTween.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RESTween.Core --version 1.7.10
                    
#r "nuget: RESTween.Core, 1.7.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RESTween.Core@1.7.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RESTween.Core&version=1.7.10
                    
Install as a Cake Addin
#tool nuget:?package=RESTween.Core&version=1.7.10
                    
Install as a Cake Tool

RESTween.Core

RESTween.Core contains the shared contract attributes used by the RESTween client and server packages.

Install this package when you want to define REST API interfaces in a shared assembly without taking a dependency on the client runtime (RESTween) or the server source generator (RESTween.Server).

What This Package Provides

  • HTTP method attributes: [Get], [Post], [Put], [Delete].
  • Parameter binding attributes: [Route], [Query], [Body], [Header].
  • Query collection formatting through CollectionFormat.
  • A small netstandard2.0 contract assembly that can be referenced by shared DTO or contract projects.

Install

dotnet add package RESTween.Core

Most users do not need to install this package directly. It is installed automatically when you install RESTween or RESTween.Server.

Use it directly when you have a separate contracts project:

MyApp.Contracts -> RESTween.Core
MyApp.Client    -> RESTween
MyApp.Api       -> RESTween.Server

Define Shared API Contracts

using RESTween.Attributes;

public interface IUserApi
{
    [Get("/users/{id}")]
    Task<UserDto> GetUserAsync([Route] int id);

    [Get("/users")]
    Task<IReadOnlyList<UserDto>> SearchUsersAsync([Query] UserSearchQuery query);

    [Post("/users")]
    Task<UserDto> CreateUserAsync([Body] CreateUserDto dto);

    [Put("/users/{id}")]
    Task<UserDto> UpdateUserAsync([Route] int id, [Body] UpdateUserDto dto);

    [Delete("/users/{id}")]
    Task DeleteUserAsync([Route] int id);
}

The same interface can then be used:

  • On the client side by RESTween to create HTTP proxy clients.
  • On the server side by RESTween.Server to generate ASP.NET Core controllers.
  • In shared libraries to keep API contracts and DTOs in one place.

HTTP Method Attributes

Use these attributes on interface methods:

[Get("/users/{id}")]
[Post("/users")]
[Put("/users/{id}")]
[Delete("/users/{id}")]

Each method attribute stores the URL template. The client package turns it into an outgoing HttpRequestMessage; the server package turns it into ASP.NET Core routing attributes.

Parameter Binding Attributes

Route

[Get("/users/{id}")]
Task<UserDto> GetUserAsync([Route] int id);

You can also provide an explicit route placeholder name:

[Get("/users/{userId}")]
Task<UserDto> GetUserAsync([Route("userId")] int id);

Query

[Get("/users")]
Task<IReadOnlyList<UserDto>> SearchAsync([Query("term")] string searchTerm);

Collections can use the default format or CollectionFormat.Multi:

[Get("/users")]
Task<IReadOnlyList<UserDto>> SearchAsync(
    [Query("role", CollectionFormat.Multi)] string[] roles);

CollectionFormat.Multi is used by the client package to emit repeated name[] query keys.

Body

[Post("/users")]
Task<UserDto> CreateUserAsync([Body] CreateUserDto dto);

The client package serializes body values as JSON. The server package maps them to ASP.NET Core [FromBody].

[Get("/profile")]
Task<ProfileDto> GetProfileAsync([Header("Authorization")] string authorization);

The client package writes parameter values into request headers. The server package maps them to ASP.NET Core [FromHeader].

Client-Only Attributes

Some attributes are intentionally not part of RESTween.Core because they describe client request-building behavior rather than shared HTTP contracts.

These attributes live in the RESTween client package:

  • [Headers] for static request headers.
  • [Multipart] for multipart/form-data client requests.
  • [Cache] for metadata inspected by custom client handlers.
  • [RateLimit] for metadata inspected by custom client handlers.

They keep the same namespace, RESTween.Attributes, so client code can still use the same using directive after installing RESTween.

What This Package Does Not Do

RESTween.Core does not:

  • Send HTTP requests.
  • Register DI services.
  • Generate ASP.NET Core controllers.
  • Serialize request or response bodies.
  • Provide client-only request-building metadata such as [Headers], [Multipart], [Cache], or [RateLimit].

For HTTP clients, install RESTween.

For server controller generation, install RESTween.Server.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on RESTween.Core:

Package Downloads
RESTween

RESTween is a lightweight dynamic REST API client for .NET. It creates runtime HTTP clients from interface contracts, supports GET, POST, PUT, DELETE, route/query/header/body/multipart binding, custom request handlers, and an extensible request-building pipeline.

RESTween.Server

Runtime ASP.NET Core controller generation for RESTween API interfaces using Reflection.Emit.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.7.10 156 5/7/2026
1.7.9 134 5/7/2026
1.6.8 132 5/7/2026
1.6.7 134 5/6/2026
1.6.6 136 5/6/2026
1.6.5 163 5/3/2026
1.6.4 165 5/3/2026
1.6.3 166 4/30/2026
1.6.2 153 4/30/2026
1.6.1 156 4/30/2026