Relative view issue

Hello everyone, 

I am trying to place relative view using api. But I am facing problem, upto selection of required entities its working then it return null while inserting view. If anyone aware of thid please let me know.