REST API and unique id

Thanks this also helped me!

We should see rest API as update only.

Just create your sensor via a template first, you can even do this via the UI now:
Settings → devices&services → helpers → template

The next api call will update that sensor:
/api/states/sensor.shared_energy