Skip to content

Feature Request: Add API Call Support from API File (Similar to RTK initiate) #19

Description

@DeveloperRejaul

Feature Request: Add API Call Support from API File (Similar to RTK initiate)

Description

Currently, there is no option to call an API directly from the API file, similar to Redux Toolkit Query's initiate method.

It would be helpful to have a way to trigger API requests programmatically without relying on hooks. This is useful for scenarios such as:

  • Calling APIs from utility functions
  • Server-side logic
  • Background tasks
  • Middleware
  • Non-React environments

Expected Behavior

Provide a method similar to RTK Query's initiate, allowing developers to call an endpoint directly from the API definition.

Example

await api.endpoints.getUser.initiate({ id: 1 });

or an equivalent API supported by the library.

Benefits

  • Enables programmatic API calls.
  • Improves flexibility for non-component use cases.
  • Provides a familiar developer experience for users migrating from RTK Query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions