Fixed spacing in api folder

Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Id7779dca4d1185245cf5764102b8de8b232c34b6