created api call for creating a new terminal in a window