Blood flow simulations can be improved by integrating known data into the numerical simulations. Data assimilation techniques based on a variational approach play an important role in this issue. We propose a nonlinear optimal control problem to reconstruct the blood flow profile from partial observations of known data in idealized 2D stenosed vessels. The wall shear stress is included in the cost function, which is considered as an important indicator for medical purposes. To simplify we assume blood flow as an homogeneous fluid with non-Newtonian behavior. Using a Discretize then Optimize (DO) approach, we solve the nonlinear optimal control problem and we propose a weighted cost function that accurately recovers both the velocity and the wall shear stress profiles. The robustness of such cost function is tested with respect to different velocity profiles and degrees of stenosis. The filtering effect of the method is also confirmed. We conclude that this approach can be successfully used in the 2D case.