@salesforce/agents
    Preparing search index...

    Function requestWithEndpointFallback

    • Makes an API request with automatic endpoint fallback. Tries api.salesforce.com first. For orgs on internal instances only, then tries test., dev., and stage.api.salesforce.com on 404. A fallback host that can't be reached is skipped, so its connection error never hides the 404 from api.salesforce.com.

      GovCloud orgs, identified by the sfap_rh claim of the connection's JWT, are sent to the GovCloud hosts of their environment instead, with the x-salesforce-region header SFAP routes them on.

      Type Parameters

      • T

      Parameters

      • connection: Connection

        The Salesforce connection

      • requestInfo: RequestInfo

        The request information (url, method, headers, body, etc.)

      • Optionaloptions: { retry?: { maxRetries?: number } }

        Optional retry/timeout options

      Returns Promise<T>

      The API response

      SfError if all endpoints return 404 or are unreachable, or immediately on other errors