Update Api.cs

Encoding corrected and local variables uniformed