Is there any official Microsoft documentation about the apis you are using in build/deploy.ps1?
e.g. https://hostname/api/upload/request
and the properties packageUris.api and packageUris.app
I assume you reverse engineered the swa cli deploy command?