diff --git a/.run/requests/block.http b/.run/requests/block.http new file mode 100644 index 00000000..ce7ef006 --- /dev/null +++ b/.run/requests/block.http @@ -0,0 +1,24 @@ +### Get blocks list +http://{{host}}/v1/block + +### Get blocks count +http://{{host}}/v1/block/count + +### Get genesis block +http://{{host}}/v1/block/0 + +### Get block by height +http://{{host}}/v1/block/12 + +### Get block events +http://{{host}}/v1/block/20345/events + +### Get block stats +http://{{host}}/v1/block/20345/stats + +### Get block namespaces +http://{{host}}/v1/block/20345/namespace + +### Get block namespaces count +http://{{host}}/v1/block/20345/namespace/count + diff --git a/cmd/api/handler/block.go b/cmd/api/handler/block.go index 24adfb95..ee1ce808 100644 --- a/cmd/api/handler/block.go +++ b/cmd/api/handler/block.go @@ -40,11 +40,11 @@ func NewBlockHandler( } type getBlockByHeightRequest struct { - Height types.Level `param:"height" validate:"required,min=0"` + Height types.Level `param:"height" validate:"min=0"` } type getBlockRequest struct { - Height types.Level `param:"height" validate:"required,min=0"` + Height types.Level `param:"height" validate:"min=0"` Stats bool `query:"stats" validate:"omitempty"` }