The PTC Community email address has changed to email@example.com. Learn more.
How to create/upload representation through API?
If the file exists serve side or is accessible by the server you can use Java api to create new application data then add it to a content holder, in this case a representation.
To upload from client side would need some additional cusotmisation of the UI to add a button to open the file browser etc etc
I would start to study how a AfterLoader works.
You can check the source code and learn how to add a additional files to a representation.
During a changing name the file is stored again to a representation.
From that point you can create new representation by general API to store a new object, and then attach a file as primary representation content (ContentRoleType.PRODUCT_VIEW_ED).