NDEx JavaScript Client API Reference - v0.6.0-alpha.5
    Preparing search index...

    Class NetworkServiceV2

    NetworkServiceV2 - NDEx API v2 network operations Handles legacy v2 endpoints with modern TypeScript interface

    Index

    Constructors

    Methods

    • Get raw network in CX1 format

      Returns raw CX1 data as an array of aspects. This data may contain fragmented aspects that need to be assembled into a complete CX1 network model for proper usage. For a fully assembled network object, consider using getNetworkAsCX2Object() instead.

      Parameters

      • networkUUID: string

        The UUID of the network to retrieve

      • options: AccessParams = {}

        Access options including optional access key

      Returns Promise<any[]>

      Promise resolving to raw CX1 data as an array of aspects

    • Update network summary

      Updates the summary information for an existing network. This allows modification of network metadata such as name, description, visibility, and other summary properties without updating the actual network content (nodes/edges).

      Parameters

      • networkUUID: string

        The UUID of the network to update

      • networkSummary: NetworkSummaryV2

        The updated network summary object containing the new metadata

      Returns Promise<void>

      Promise that resolves when the update is complete

      // Update network name and description
      await networkService.updateNetworkSummary('12345678-1234-1234-1234-123456789abc', {
      externalId: '12345678-1234-1234-1234-123456789abc',
      name: 'Updated Network Name',
      description: 'Updated network description',
      nodeCount: 150,
      edgeCount: 200,
      visibility: 'PUBLIC',
      owner: 'username',
      ownerUUID: 'user-uuid',
      creationTime: 1234567890,
      modificationTime: 1234567890,
      isReadOnly: false,
      isValid: true,
      hasLayout: true,
      hasSample: false,
      updatedBy: 'username'
      });
    • Copy network

      Creates a copy of an existing network using the server's copy endpoint. The copied network will have the same content but will be assigned a new UUID and will be owned by the authenticated user.

      Parameters

      • networkUUID: string

        The UUID of the network to copy

      Returns Promise<string>

      Promise resolving to the URL of the cloned CX1 network

    • Search networks (migrated from original NDEx.js)

      Searches networks using POST request with search parameters in the request body. This implementation matches the original NDEx.js searchNetworks function.

      Parameters

      • searchTerms: string

        Search string to find networks

      • Optionalstart: number

        Starting offset for pagination (optional)

      • Optionalsize: number

        Maximum number of results to return (optional)

      • OptionaloptionalParameters: { permission?: string; includeGroups?: boolean; accountName?: string }

        Additional search filters

        • Optionalpermission?: string

          Filter by permission level

        • OptionalincludeGroups?: boolean

          Whether to include group networks

        • OptionalaccountName?: string

          Filter by account name

      Returns Promise<any>

      Promise resolving to search results

    • Create new network from raw CX1 data

      Creates a new network in NDEx from raw CX1 network data. This method handles the server response parsing to extract the network UUID from the location header.

      Parameters

      • rawCX: any[]

        Raw CX1 network data as an array of aspects

      • options: { visibility?: Visibility } = {}

        Optional options for network creation (visibility settings)

      Returns Promise<string>

      Promise resolving to the UUID string of the newly created network

    • Update network from raw CX1 data

      Updates an existing network in NDEx with new raw CX1 network data. This completely replaces the network content with the provided CX1 data. Uses the legacy v2 endpoint format from the original NDEx.js implementation.

      Parameters

      • networkUUID: string

        The UUID of the network to update

      • rawCX: any[]

        Raw CX1 network data as an array of aspects

      Returns Promise<void>

      Promise resolving when the update is complete

    • Get network summaries by UUIDs (migrated from original NDEx.js)

      Retrieves network summaries for multiple networks in a single batch request. Uses the V2 API batch endpoint for efficient bulk operations.

      Parameters

      • uuidList: string[]

        Array of network UUIDs to retrieve summaries for

      • OptionalaccessKey: string

        Optional access key for private networks

      Returns Promise<NetworkSummaryV2[]>

      Promise resolving to array of network summaries

    • Set network system properties

      Parameters

      • networkUUID: string
      • properties: Record<string, any>

      Returns Promise<void>

    • Grant network permission to user

      Parameters

      • networkUUID: string
      • userUUID: string
      • permission: Permission

      Returns Promise<void>

    • Revoke network permission from user

      Parameters

      • networkUUID: string
      • userUUID: string

      Returns Promise<void>

    • Get network profile (additional metadata)

      Parameters

      • networkUUID: string

      Returns Promise<any>

    • Set network profile

      Parameters

      • networkUUID: string
      • profile: any

      Returns Promise<void>

    • Make network public

      Parameters

      • networkUUID: string

      Returns Promise<void>

    • Make network private

      Parameters

      • networkUUID: string

      Returns Promise<void>

    • Get network metadata (migrated from original NDEx.js)

      Retrieves metadata information about network aspects including element counts, versions, and ID counters for each aspect in the network. This provides an overview of the network's structure and content organization.

      Parameters

      • networkUUID: string

        The UUID of the network to get metadata for

      • OptionalaccessKey: string

        Optional access key for private networks

      Returns Promise<CX1MetaDataResponse>

      Promise resolving to metadata containing aspect information

      const metadata = await networkService.getMetaData('network-uuid');
      // Returns: { metaData: [{ name: 'nodes', elementCount: 330, version: '1.0' }, ...] }
    • Get network access key (migrated from original NDEx.js)

      Retrieves the current access key for a network. Access keys allow users to share private networks without requiring individual permissions.

      Parameters

      • networkUUID: string

        The UUID of the network to get access key for

      Returns Promise<AccessKeyResponse>

      Promise resolving to access key response object

      const response = await networkService.getAccessKey('network-uuid');
      console.log(response.accessKey); // "acialdfeoa03430023" or null
    • Update network access key (migrated from original NDEx.js)

      Enables or disables the access key for a network. When enabled, creates a new access key that can be shared. When disabled, invalidates the current access key.

      Parameters

      • networkUUID: string

        The UUID of the network to update access key for

      • action: AccessKeyAction

        Action to perform: 'enable' creates/updates key, 'disable' removes it

      Returns Promise<AccessKeyResponse>

      Promise resolving to access key response (accessKey will be null when disabled)

      // Enable access key
      const enabled = await networkService.updateAccessKey('network-uuid', 'enable');
      console.log(enabled.accessKey); // "new-access-key-string"

      // Disable access key
      const disabled = await networkService.updateAccessKey('network-uuid', 'disable');
      console.log(disabled.accessKey); // null