Rehooks

API

The API reference is a detailed documentation of all the endpoints available in the API.

Introduction

Rehooks API is a RESTFul API that allows you to get all the information of the hooks that are in the repository.

Limitations

The API is currently open to everyone and does not require any authentication. However, to prevent abusive use of the API, there is a limit to the number of requests.

Base URL

The base URL for the API is:

https://rehooks.pyr33x.ir/api

Typescript usage

  • For Hooks:
type Hook = {
  id: number;
  title: string;
  description: string;
  content: string;
};

Endpoints

GET /hooks

This endpoint returns a list of all the hooks in the repository.

Parameters

  • limit: The number of hooks to return. Has no default value.
  • search: A string to search for in the title of the hooks.

Usage

GET /hooks

Response

[
  {
    "id": 0,
    "title": "useClipboard",
    "description": "A hook that provides a function to copy text to the clipboard.",
    "content": "..."
  }
]

GET /hooks/:title

This endpoint returns the details of a specific hook.

Parameters

  • title: The ID of the hook to get.

Usage

GET /hooks/useKeyPress

Response

[
  {
    "id": 9,
    "title": "useKeyPress",
    "description": "Custom hook to detect if a specified key is pressed.",
    "content": "..."
  }
]

Limit Query Parameter

Query Parameter

  • limit: The number of hooks to return. Has no default value.
  • ?limit=10: Returns the first 10 hooks.

You can use the limit query parameter to limit the number of hooks returned. For example, to get the first 10 hooks, you can use the following URL:

GET /hooks?limit=10

Search Query Parameter

Query Parameter

  • search: A string to search for in the title of the hooks.
  • ?search=useKeyPress: Returns all the hooks that contain the word "useKeyPress".

You can use the search query parameter to search for a specific hook. For example, to search for the hook useKeyPress, you can use the following URL:

GET /hooks?search=useKeyPress

On this page