Member Junction
    Preparing search index...

    Action that adds rate limiting to any API endpoint

    // Rate limit API calls
    await runAction({
    ActionName: 'API Rate Limiter',
    Params: [{
    Name: 'URL',
    Value: 'https://api.example.com/data'
    }, {
    Name: 'Method',
    Value: 'GET'
    }, {
    Name: 'RateLimitKey',
    Value: 'example-api'
    }, {
    Name: 'MaxRequestsPerMinute',
    Value: 60
    }, {
    Name: 'MaxConcurrent',
    Value: 5
    }]
    });

    // With authentication and retry
    await runAction({
    ActionName: 'API Rate Limiter',
    Params: [{
    Name: 'URL',
    Value: 'https://api.example.com/users'
    }, {
    Name: 'Headers',
    Value: { 'Authorization': 'Bearer token' }
    }, {
    Name: 'RateLimitKey',
    Value: 'example-api'
    }, {
    Name: 'RetryOnRateLimit',
    Value: true
    }, {
    Name: 'BackoffMs',
    Value: 1000
    }]
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    AuthorizesCaller: boolean

    True when the action authorizes its caller itself, so a public entry point such as the RunAction mutation may run it for an authenticated user without an MJ: Action Authorizations link. Set it only on an action that either checks an authorization the caller must hold, or reads and writes only with the caller's own permissions. Leave it false for an action that acts with more authority than its caller, or that reaches data or sends messages the caller chooses but could not otherwise reach.

    The engine reads the marker only from the class that runs, never from its parent classes. A subclass that overrides a marked action must declare the marker again.

    Methods

    • Execute API request with rate limiting

      Parameters

      • params: RunActionParams

        The action parameters containing:

        • URL: API endpoint URL (required)
        • Method: HTTP method (default: GET)
        • Headers: Request headers
        • Body: Request body
        • RateLimitKey: Unique key for rate limiter instance (required)
        • MaxRequestsPerMinute: Max requests per minute (default: 60)
        • MaxConcurrent: Max concurrent requests (default: 5)
        • RetryOnRateLimit: Retry on 429 errors (default: true)
        • BackoffMs: Initial backoff in ms (default: 1000)
        • MaxRetries: Max retry attempts (default: 3)
        • Timeout: Request timeout in ms (default: 30000)

      Returns Promise<ActionResultSimple>

      API response with rate limit info