The following example shows you how to upload a file to OneDrive.
To access OneDrive for Business with the API you have to set site url as https://<domain>-my.sharepoint.com/personal/<username>
If our Office 365 domain is "independentsoft" and username is "email@example.com" than OneDrive site url will be:
*You have to replace "@" and "." from your username with "_"