The [BusinessDataRepository][1] is designed and powerful because the data in it is always usually attached to a [IBusinessCase][2]. So it makes perfect sort of sense to me that the example here does not work with the ivy.repo() API as there is no Task or Case set up when a client uses the REST api.
If you really But the relation (between repo & BusinessData) is not strictly enforced and lives in a separate db table.
So it looks like a minor bug to me. I opened an issue for it: https://jira.axonivy.com/jira/browse/XIVY-3074
Workaround up till then: store data that is associated with a [IBusinessCase][2] you could start in a process. Within it you have a Task/Case.
[1]: https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/business/data/store/BusinessDataRepository.html
[2]: https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/workflow/businesscase/IBusinessCase.html