#5989: Translate API call to SQL