Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
47e11e0
Added `RestServer` Plugin
cschuchardt88 Jul 2, 2024
bd94807
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Jul 5, 2024
e261aa6
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Jul 9, 2024
5e8d98f
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Jul 16, 2024
6ab87d5
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Jul 17, 2024
a8ac960
Update neo.sln
cschuchardt88 Jul 17, 2024
03e2298
Fixed issue with merging from master
cschuchardt88 Jul 17, 2024
287bbd7
Added @superboyiii request changes `PART-1`
cschuchardt88 Jul 17, 2024
08f74a6
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Jul 17, 2024
8f0c919
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Jul 27, 2024
758894c
Update `sln` file
cschuchardt88 Jul 28, 2024
b45c59a
Added better checking for `IsNep11Supported` and `IsNep17Supported`
cschuchardt88 Jul 28, 2024
9dd47d9
Added `Confirmations` to `Block` JSON output
cschuchardt88 Jul 28, 2024
b310d99
variable name fixes
cschuchardt88 Jul 28, 2024
bcf109d
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Aug 2, 2024
6d8f294
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Aug 7, 2024
5240a05
Merge branch 'master' into add/plugins/rest-server
Aug 14, 2024
498fd37
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Sep 1, 2024
7d9786e
Added `Signers` for `Invoking` contracts
cschuchardt88 Sep 1, 2024
5dd2083
Revert `Neo.CLI` Configuation file
cschuchardt88 Sep 1, 2024
698b88d
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Sep 10, 2024
cc5ec4c
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Oct 3, 2024
5167332
Added `using` for `Neo.Extensions`
cschuchardt88 Oct 3, 2024
613e061
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Oct 13, 2024
91f3d42
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Oct 15, 2024
44d8edd
Update src/Plugins/RestServer/Helpers/ScriptHelper.cs
cschuchardt88 Nov 8, 2024
f34d387
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Nov 8, 2024
8c48031
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Nov 11, 2024
845c9ea
Merge branch 'master' into add/plugins/rest-server
Nov 26, 2024
5c29eb7
Fixed InvokeMethod
cschuchardt88 Nov 26, 2024
3921d3f
Merge branch 'add/plugins/rest-server' of https://github.com/cschucha…
cschuchardt88 Nov 26, 2024
87dc996
dotnet format
cschuchardt88 Nov 26, 2024
b061e15
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Nov 27, 2024
2ef32eb
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Nov 28, 2024
6949fc3
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Dec 4, 2024
39cbecd
fixed extensions
cschuchardt88 Dec 4, 2024
5feeffc
Fixed extensions bug
cschuchardt88 Dec 4, 2024
4e83091
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Dec 7, 2024
34ede17
Update src/Plugins/RestServer/RestServer.json
cschuchardt88 Dec 8, 2024
c6d65b2
Update src/Plugins/RestServer/RestServer.json
cschuchardt88 Dec 8, 2024
ecce127
Update src/Plugins/RestServer/RestServer.json
cschuchardt88 Dec 8, 2024
a3b6c42
Merge branch 'master' into add/plugins/rest-server
Dec 21, 2024
3bdf875
Merge branch 'master' into add/plugins/rest-server
Dec 23, 2024
7c90b35
Merge branch 'master' into add/plugins/rest-server
Dec 26, 2024
05b7098
Merge branch 'master' into add/plugins/rest-server
shargon Dec 27, 2024
91794c5
Merge branch 'master' into add/plugins/rest-server
Jan 3, 2025
f045c5a
Merge branch 'master' into add/plugins/rest-server
Jan 23, 2025
c71d2af
ran `dotnet format`
cschuchardt88 Jan 23, 2025
e58877d
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Jan 26, 2025
93751a5
Fixed variable names and removed some extensions that were unused, re…
cschuchardt88 Jan 26, 2025
2cf5a80
Merge branch 'master' into add/plugins/rest-server
Jan 27, 2025
f6802a5
Merge branch 'master' into add/plugins/rest-server
shargon Jan 27, 2025
b3e6fa2
Update src/Plugins/RestServer/Models/Node/PluginModel.cs
shargon Jan 29, 2025
b8e2b5f
Update src/Plugins/RestServer/Exceptions/JsonPropertyNullOrEmptyExcep…
shargon Jan 29, 2025
92665bb
Apply suggestions from code review
shargon Jan 30, 2025
aca2618
Merge branch 'master' into add/plugins/rest-server
shargon Jan 30, 2025
bbfab38
Merge branch 'master' into add/plugins/rest-server
Feb 10, 2025
974fbd6
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Feb 11, 2025
2406ff8
Merge branch 'master' into add/plugins/rest-server
Feb 11, 2025
443d108
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Feb 11, 2025
f4400e7
Added paging to `neo` and `gas` account endpoints\
cschuchardt88 Feb 11, 2025
1baf2eb
Merge branch 'master' into add/plugins/rest-server
Feb 12, 2025
71fdbdf
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Feb 12, 2025
b4f0659
Merge branch 'master' into add/plugins/rest-server
Feb 13, 2025
57f82cc
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Feb 19, 2025
422f6e1
Merge branch 'master' into add/plugins/rest-server
Feb 21, 2025
a6617e8
Merge branch 'master' into pr/3390
Jim8y Mar 24, 2025
0fc307a
fix build error
Jim8y Mar 24, 2025
f05eba1
Merge branch 'master' into add/plugins/rest-server
Mar 25, 2025
e8dbe54
Merge branch 'master' into add/plugins/rest-server
Apr 10, 2025
c5ff48c
merge master
Apr 10, 2025
bb2cef6
apply rate limiting
Apr 10, 2025
460cc50
remove extra comment
Apr 10, 2025
f52ad23
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 Apr 12, 2025
5ff9476
Updated libraries
cschuchardt88 Apr 12, 2025
fd5b10d
fixed tests
cschuchardt88 Apr 12, 2025
7602060
change dotnet version
cschuchardt88 Apr 12, 2025
3da51a9
downloadgrade veersion
cschuchardt88 Apr 12, 2025
d269acb
Merge branch 'master' into add/plugins/rest-server
shargon Apr 17, 2025
d509a51
Merge branch 'master' into add/plugins/rest-server
Apr 22, 2025
00446dd
Merge branch 'master' into add/plugins/rest-server
NGDAdmin Apr 29, 2025
b8cc9ca
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 May 7, 2025
2a504b0
Apply suggestions from code review
shargon May 19, 2025
0d1adbd
Update src/Plugins/RestServer/RestServer.csproj
shargon May 19, 2025
24f2f56
Add <IsTestProject>true</IsTestProject>
shargon May 19, 2025
3dfe79b
Merge branch 'master' into add/plugins/rest-server
shargon May 19, 2025
6792a00
Merge branch 'master' into add/plugins/rest-server
cschuchardt88 May 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions docs/RestServer/Addons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
## RestServer Plugin
In this section of you will learn how to make a `neo-cli` plugin that integrates with `RestServer`
plugin. Lets take a look at [Example Plugin](/examples/RestServerPlugin).

- No reference to `RestServer` is required.
- Requires DotNet 7.0

## Folder Structure
```bash
Project
├── Controllers
│ └── ExampleController.cs
├── ExamplePlugin.cs
├── ExamplePlugin.csproj
├── Exceptions
│ └── CustomException.cs
└── Models
└── ErrorModel.cs
```
The only thing that is important here is the `controllers` folder. This folder is required for the `RestServer`
plugin to register the controllers in its web server. This location is where you put all your controllers.

## Controllers
The `controller` class is the same as ASP.Net Core's. Controllers must have their attribute set
as `[ApiController]` and inherent from `ControllerBase`.

## Swagger Controller
A `Swagger` controller uses special attributes that are set on your controller's class.

**Controller Class Attributes**
- `[Produces(MediaTypeNames.Application.Json)]` (_Required_)
- `[Consumes(MediaTypeNames.Application.Json)]` (_Required_)
- `[ApiExplorerSettings(GroupName = "v1")]`
- **GroupName** - _is which version of the API you are targeting._
- `[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ErrorModel))]` (_Required_)
- **Type** - _Must have a base class of [error](#error-class)._

## Error Class
Needs to be the same as `RestServer` of else there will be some inconsistencies
with end users not knowing which type to use. This class can be `public` or `internal`.
Properties `Code`, `Name` and `Message` values can be whatever you desire.

**Model**
```csharp
public class ErrorModel
{
public int Code { get; set; };
public string Name { get; set; };
public string Message { get; set; };
}
```

## Controller Actions
Controller actions need to have special attributes as well as code comments.

- `[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]`

HTTP status code `200 (OK)` is required with return type defined. You can use more than one attribute. One per HTTP status code.

### Action Example
```csharp
[HttpGet("contracts/{hash:required}/sayHello", Name = "GetSayHello")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
public IActionResult GetSayHello(
[FromRoute(Name = "hash")]
UInt160 scripthash)
{
if (scripthash == UInt160.Zero)
return NoContent();
return Ok($"Hello, {scripthash}");
}
```
Notice that the _above_ example also returns with HTTP status code of `204 No Content`.
This action `route` also extends the `contracts` API. Adding method `sayHello`. Routes
can be what you like as well. But if you want to extend on any existing controller you
must use existing routes paths.

### Path(s)
- `/api/v1/contracts/`
- `/api/v1/ledger/`
- `/api/v1/node/`
- `/api/v1/tokens`
- `/api/v1/Utils/`

### Excluded Path(s)
- `/api/v1/wallet/`

_for security reasons_.

### Code Comments for Swagger
```csharp
/// <summary>
///
/// </summary>
/// <param name="" example=""></param>
/// <returns></returns>
/// <response code="200">Successful</response>
/// <response code="400">An error occurred. See Response for details.</response>
```

Also note that you need to have `GenerateDocumentationFile` enabled in your
`.csproj` file. The `xml` file that is generated; in our case would be `RestServerPlugin.xml`.
This file gets put in same directory `Plugins/RestServerPlugin/` which is in the root of `neo-node`
executable folder. Where you will see `neo-cli.exe`.

File `RestServerPlugin.xml` will get added to `Swagger` automatically by the `RestServer`
plugin.
54 changes: 54 additions & 0 deletions docs/RestServer/ConfigFile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Table

| Name | Type | Description |
| :--- | :---: | :--- |
|**Network**|_uint32_|_Network you would like the `RestServer` to be enabled on._|
|**BindAddress**|_string_|_Ip address of the interface you want to bind too._|
|**Port**|_uint32_|_Port number to bind too._|
|**KeepAliveTimeout**|_uint32_|_Time to keep the request alive, in seconds._|
|**SslCertFile**|_string_|_Is the path and file name of a certificate file, relative to the directory that contains the node's executable files._|
|**SslCertPassword**|_string_|_Is the password required to access the `X.509` certificate data._|
|**TrustedAuthorities**|_StringArray_|_Tumbprints of the of the last certificate authority in the chain._|
|**EnableBasicAuthentication**|_boolean_|_enables basic authentication._|
|**RestUser**|_string_|_Basic authentication's `username`._|
|**RestPass**|_string_|_Basic authentication's `password`._|
|**EnableCors**|_boolean_|_Enables Cross-origin resource sharing (`CORS`). Note by default it enables `*` any origin._|
|**AllowOrigins**|_StringArray_|_A list of the origins to allow. Note needs to add origins for basic auth to work with `CORS`._|
|**DisableControllers**|_StringArray_|_A list of `controllers` to be disabled. Requires restart of the node, if changed._|
|**EnableCompression**|_boolean_|_Enables `GZip` data compression._|
|**CompressionLevel**|_enum_|_Compression level. Values can be `Fastest`, `Optimal`, `NoCompression` or `SmallestSize`_|
|**EnableForwardedHeaders**|_boolean_|_Enables response/request headers for proxy forwarding. (data center usage)_|
|**EnableSwagger**|_boolean_|_Enables `Swagger` with `Swagger UI` for the rest services._|
|**MaxPageSize**|_uint32_|_Max page size for searches on `Ledger`/`Contracts` route._|
|**MaxConcurrentConnections**|_int64_|_Max allow concurrent HTTP connections._|
|**MaxInvokeGas**|_int64_|_Max gas to be invoked on the `Neo` virtual machine._|

## Default "Config.json" file
```json
{
"PluginConfiguration": {
"Network": 860833102,
"BindAddress": "127.0.0.1",
"Port": 10339,
"KeepAliveTimeout": 120,
"SslCertFile": "",
"SslCertPassword": "",
"TrustedAuthorities": [],
"EnableBasicAuthentication": false,
"RestUser": "",
"RestPass": "",
"EnableCors": true,
"AllowOrigins": [],
"DisableControllers": [ "WalletController" ],
"EnableCompression": true,
"CompressionLevel": "SmallestSize",
"EnableForwardedHeaders": false,
"EnableSwagger": true,
"MaxPageSize": 50,
"MaxConcurrentConnections": 40,
"MaxTransactionFee": 10000000,
"MaxInvokeGas": 20000000,
"WalletSessionTimeout": 120
}
}
```
144 changes: 144 additions & 0 deletions docs/RestServer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
## RestServer
In this section you will learn about `RestServer` plugin and how it works.

See [config.json](ConfigFile.md) for information about the configurations.

## Dependencies
- **Microsoft.AspNetCore.JsonPatch.dll** `Required`
- **Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll** `Required`
- **Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll** `Required`
- **Microsoft.AspNetCore.Mvc.Versioning.dll** `Required`
- **Microsoft.OpenApi.dll** `Required`
- **Newtonsoft.Json.Bson.dll** `Required`
- **Newtonsoft.Json.dll** `Required`
- **System.ServiceProcess.ServiceController.dll** `Required`
- **Microsoft.AspNetCore.Mvc.Versioning.dll** `Required`
- **Microsoft.AspNetCore.Mvc.Versioning.dll** `Required`
- **Microsoft.AspNetCore.Mvc.Versioning.dll** `Required`
- **Microsoft.OpenApi.dll** `Swagger`
- **Swashbuckle.AspNetCore.Swagger.dll** `Swagger`
- **Swashbuckle.AspNetCore.SwaggerGen.dll** `Swagger`
- **Swashbuckle.AspNetCore.SwaggerUI.dll** `Swagger`
- **Swashbuckle.AspNetCore.Newtonsoft.dll** `Swagger`
- **RestServer.xml** `Swagger UI`

These files go in the same directory as the `RestServer.dll`. In neo-cli
`plugins/RestServer/` folder.

## Response Headers
| Name | Value(s) | Description |
| :---: | --- | :--- |
|**server**|_neo-cli/3.6.0 RestServer/3.6.0_|_`neo-cli` and `RestServer` version._|

Custom headers can be added by [Neo RestServer Plugins](Addons.md).

## JSON Serializer
`RestServer` uses custom NewtonSoft JSON Converters to serialize controller action
responses and `route` parameters.

**One Way Binding** - `Write` only.
- `Neo.SmartContract.ContractState`
- `Neo.SmartContract.NefFile`
- `Neo.SmartContract.MethodToken`
- `Neo.SmartContract.Native.TrimmedBlock`
- `Neo.SmartContract.Manifest.ContractAbi`
- `Neo.SmartContract.Manifest.ContractGroup`
- `Neo.SmartContract.Manifest.ContractManifest`
- `Neo.SmartContract.Manifest.ContractPermission`
- `Neo.SmartContract.Manifest.ContractPermissionDescriptor`
- `Neo.Network.P2P.Payloads.Block`
- `Neo.Network.P2P.Payloads.Header`
- `Neo.Network.P2P.Payloads.Signer`
- `Neo.Network.P2P.Payloads.TransactionAttribute`
- `Neo.Network.P2P.Payloads.Transaction`
- `Neo.Network.P2P.Payloads.Witness`

**Two Way Binding** - `Read` & `Write`
- `System.Guid`
- `System.ReadOnlyMemory<T>`
- `Neo.BigDecimal`
- `Neo.UInt160`
- `Neo.UInt256`
- `Neo.Cryptography.ECC.ECPoint`
- `Neo.VM.Types.Array`
- `Neo.VM.Types.Boolean`
- `Neo.VM.Types.Buffer`
- `Neo.VM.Types.ByteString`
- `Neo.VM.Types.Integer`
- `Neo.VM.Types.InteropInterface`
- `Neo.VM.Types.Null`
- `Neo.VM.Types.Map`
- `Neo.VM.Types.Pointer`
- `Neo.VM.Types.StackItem`
- `Neo.VM.Types.Struct`

## Remote Endpoints
Parametes `{hash}` can be any Neo N3 address or scripthash; `{address}` can be any Neo N3 address **only**; `{number}` and `{index}` can be any _**uint32**_.

**Parameter Examples**
- `{hash}` - _0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5_ **or** _NiHURyS83nX2mpxtA7xq84cGxVbHojj5Wc_
- `{address}` - _NiHURyS83nX2mpxtA7xq84cGxVbHojj5Wc_
- `{number}` - _1_
- `{index}` - _2500000_

**Paths**
- Utils
- `[GET]` `/api/v1/utils/{hash}/address`
- `[GET]` `/api/v1/utils/{address}/scripthash`
- `[GET]` `/api/v1/utils/{hash}/{address}/validate`
- Node
- `[GET]` `/api/v1/node/peers`
- `[GET]` `/api/v1/node/plugins`
- `[GET]` `/api/v1/node/settings`
- Ledger
- `[GET]` `/api/v1/ledger/neo/accounts`
- `[GET]` `/api/v1/ledger/gas/accounts`
- `[GET]` `/api/v1/ledger/blocks?page={number}&size={number}`
- `[GET]` `/api/v1/ledger/blocks/height`
- `[GET]` `/api/v1/ledger/blocks/{index}`
- `[GET]` `/api/v1/ledger/blocks/{index}/header`
- `[GET]` `/api/v1/ledger/blocks/{index}/witness`
- `[GET]` `/api/v1/ledger/blocks/{index}/transactions?page={number}&size={number}`
- `[GET]` `/api/v1/ledger/transactions/{hash}`
- `[GET]` `/api/v1/ledger/transactions/{hash}/witnesses`
- `[GET]` `/api/v1/ledger/transactions/{hash}/signers`
- `[GET]` `/api/v1/ledger/transactions/{hash}/atributes`
- `[GET]` `/api/v1/ledger/memorypool?page={number}&size={number}`
- `[GET]` `/api/v1/ledger/memorypool/verified?page={number}&size={number}`
- `[GET]` `/api/v1/ledger/memorypool/unverified?page={number}&size={number}`
- `[GET]` `/api/v1/ledger/memorypool/count`
- Tokens
- `[GET]` `/api/v1/tokens/balanceof/{address}`
- NFTs
- `[GET]` `/api/v1/tokens/nep-11?page={number}&size={number}`
- `[GET]` `/api/v1/tokens/nep-11/count`
- `[GET]` `/api/v1/tokens/nep-11/{hash}/balanceof/{address}`
- NEP-17
- `[GET]` `/api/v1/tokens/nep-17?page={number}&size={number}`
- `[GET]` `/api/v1/tokens/nep-17/count`
- `[GET]` `/api/v1/tokens/nep-17/{hash}/balanceof/{address}`
- Contracts
- `[GET]` `/api/v1/contracts?page={number}&size={number}`
- `[GET]` `/api/v1/contracts/count`
- `[GET]` `/api/v1/contracts/{hash}`
- `[GET]` `/api/v1/contracts/{hash}/abi`
- `[GET]` `/api/v1/contracts/{hash}/manifest`
- `[GET]` `/api/v1/contracts/{hash}/nef`
- `[GET]` `/api/v1/contracts/{hash}/storage`
- Wallet
- `[POST]` `/api/v1/wallet/open`
- `[POST]` `/api/v1/wallet/create`
- `[POST]` `/api/v1/wallet/{session}/address/create`
- `[GET]` `/api/v1/wallet/{session}/address/list`
- `[GET]` `/api/v1/wallet/{session}/asset/list`
- `[GET]` `/api/v1/wallet/{session}/balance/list`
- `[POST]` `/api/v1/wallet/{session}/changepassword`
- `[GET]` `/api/v1/wallet/{session}/close`
- `[GET]` `/api/v1/wallet/{session}/delete/{address}`
- `[GET]` `/api/v1/wallet/{session}/export/{address}`
- `[GET]` `/api/v1/wallet/{session}/export`
- `[GET]` `/api/v1/wallet/{session}/gas/unclaimed`
- `[GET]` `/api/v1/wallet/{session}/key/list`
- `[POST]` `/api/v1/wallet/{session}/import`
- `[POST]` `/api/v1/wallet/{session}/import/multisigaddress`
- `[POST]` `/api/v1/wallet/{session}/transfer`
60 changes: 60 additions & 0 deletions docs/RestServer/RateLimiting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Rate Limiting in Neo REST Server

## Overview

The rate limiting feature in the Neo REST Server plugin provides protection against abuse by limiting the number of requests a client can make in a given time period. This helps maintain stability, security, and performance of the REST API.

## Configuration

Rate limiting can be configured in the `RestServer.json` file with the following options:

| Parameter | Type | Description |
|-----------|------|-------------|
| `EnableRateLimiting` | boolean | Enables or disables rate limiting |
| `RateLimitPermitLimit` | integer | Maximum number of requests allowed in the specified time window |
| `RateLimitWindowSeconds` | integer | The time window in seconds for rate limiting |
| `RateLimitQueueLimit` | integer | Number of requests to queue when limit is exceeded (0 to disable queuing) |

## Default Configuration

```json
{
"EnableRateLimiting": true,
"RateLimitPermitLimit": 10,
"RateLimitWindowSeconds": 60,
"RateLimitQueueLimit": 0
}
```

By default, the configuration allows 10 requests per minute per IP address.

## How It Works

The REST Server uses ASP.NET Core's built-in rate limiting middleware (`Microsoft.AspNetCore.RateLimiting`) to implement a fixed window rate limiter. This means:

1. Requests are tracked based on the client's IP address
2. A fixed time window (configured by `RateLimitWindowSeconds`) determines the period for counting requests
3. When the limit is reached, clients receive a 429 (Too Many Requests) response with a Retry-After header

## Response Format

When a client exceeds the rate limit, they receive:

- HTTP Status: 429 Too Many Requests
- Header: `Retry-After: [seconds]`
- Body: Error message indicating when they can try again

## Use Cases

Rate limiting is particularly useful for:

1. **Preventing API Abuse**: Limits the number of requests a user or client can make
2. **Ensuring Fair Usage**: Prevents individual clients from monopolizing server resources
3. **Protecting Resources**: Controls the number of requests to prevent server overload
4. **Enhancing Security**: Helps mitigate certain types of denial of service attacks

## Important Notes

- Rate limiting is applied at the IP address level and affects all endpoints
- If your application has legitimate high-volume needs, consider adjusting the limits accordingly
- For applications with multiple clients behind a single IP (e.g., corporate proxies), consider implementing your own rate limiting logic that takes into account application-specific identifiers
Loading
Loading