Understanding coronal heating remains a central problem in solar physics. Many mechanisms have been proposed to explain how energy is transferred to and deposited in the corona. We summarise past observational studies that attempted to identify the heating mechanism and point out the difficulties in reproducing the observations of the solar corona from the heating models. The aim of this paper is to study whether the observed EUV emission in individual coronal loops in solar active regions can provide constraints on the volumetric heating function, and to develop a diagnostics for the heating function for a subset of loops that are found close to static thermal equilibrium. We reconstruct the coronal magnetic field from SDO/HMI data using a non-linear force free magnetic field model. We model selected loops using a 1D stationary model, with a heating rate dependent locally on the magnetic field strength along the loop, and calculate the emission from these loops in various EUV wavelengths for different heating rates. We present a method to measure a power index β defining the dependence of the volumetric heating rate E H on the magnetic field, E H ∝ B β , and controlling also the shape of the heating function: concentrated near the loop top, uniform and concentrated near the footpoints. The diagnostics is based on the dependence of the electron density on the index β. This method is free from the assumptions of the loop filling factor but requires spectroscopic measurements of the density-sensitive lines. The range of applicability for loops of different length and heating distributions is discussed, and the steps to solving the coronal heating problem are outlined.