If anyone wonders how to do this for external content and retrieve an externalitemId:
Use the Graph Search API and request either the field substrateContentDomainId or fileID. The value after the comma in fileID and substrateContentDomainId should be the ExternalItem id.