Add a few things on initAPI

1 access-allow-origin
2 error code enhancement