AboutSupportDeveloper GuideVersion 1.0.1
ServiceNowConnection: {
    clientId: string;
    currentUser: User;
    disconnect: (() => Promise<void>);
    instanceUrl: string;
    executeApiRequest<T>(apiEndpoint, httpMethod?, data?, suppressResponseBody?, headers?) => Promise<ServiceNowRestApiResponse<T>>;
}

A connection to a ServiceNow instance.

Type declaration

  • clientId: string

    ID of the registered OAuth application that was used for authorization.

  • currentUser: User

    The user that the application has been authorized to act on behalf of.

  • disconnect: (() => Promise<void>)
      • (): Promise<void>
      • Terminates the connection and cleans up utilized resources.

        Returns Promise<void>

  • instanceUrl: string

    The URL of the ServiceNow instance.

  • executeApiRequest:function
    • Executes a request to the specified endpoint of the ServiceNow REST API.

      For POST/PATCH requests, Content-Type header is set to "application/json" by default and so data parameter can simply be set to an object.

      Note: depending on which endpoint is being requested, you may need to include additional auth scopes when connecting.

      Type Parameters

      • T = unknown

        A type that describes the requested data. This API includes a number of entity types for use with this function.

      Parameters

      • apiEndpoint: string

        The relative REST API endpoint being requested (e.g. /api/now/v2/table/sn_customerservice_case).

      • Optional httpMethod: HttpMethod

        The HTTP Method to use when making the request (defaults to GET).

      • Optional data: any

        Optionally include data in the request body (for POST/PATCH requests).

      • Optional suppressResponseBody: boolean

        By default, REST API responses typically include relevant body content. Set this parameter to true to suppress the response body if it is not required.

      • Optional headers: ApiRequestHeaders

        Optionally set additional request headers. Important: do not attempt to set the Authorization header manually as the API will include it automatically (as long as includeAuthorization is not set to false).

      Returns Promise<ServiceNowRestApiResponse<T>>

      A response object containing the HTTP response status code and requested data (if relevant).

      Throws

      ApiRequestError if an error occurred when sending the request, or if the REST API responded with an error HTTP response code.

      Throws

      AuthTokenExpiredError if the current access token has expired and cannot be renewed. In this instance, you must re-connect before continuing to use this API.

Generated using TypeDoc