I need to get all the RICs thats are listed on the NASDAQ and the NYSE. I've tried using the API to pull all the RICS associated with the MIC XNAS (NaSDAq) but it's not returning anything.
.NDX in the answer by @chavalit.jintamalit is the RIC for Nasdaq 100 index. To get the list of Nasdaq stocks you want to use Nasdaq Composite index (the RIC is .IXIC).
Alternatively you can use the Screener, which provides a lot of flexibility for what you want and don't want to include in the results. E.g. the following expression returns the most complete NYSE stocks listing including ADRs, prefs etc.
ek.get_data('SCREEN(U(IN(Equity(active,public,' + 'countryprimaryquote))),' + 'IN(TR.ExchangeMarketIdCode,"XNYS"))', ['TR.CommonName'])
I'm not sure if there is a way to retrieve the entire set of RICs listed on an exchange. The best way to find out if such a RIC exists or if this is even possible is to direct content questions to the Refinitiv Helpdesk.
What is available is to retrieve constituents for a specific index on an exchange. For example, here are couple of examples of index on the NASDAQ and NYSE: