-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set id manually #32
Comments
No, entity id's are always generated by the server, specifically, by the database. Any @iot.id you specify in the json is ignored. |
Thank you for your fast reply. So the id is generated by postgre database? Do you think it is possible in principal? Is there a way to get the id of an entity one created? I couldn't find it in the response of the corresponding post request. Thank you for your help Johannes |
Yes, the id is generated by the database. In theory it's possible to allow user-generated ids, but it's a bad idea, since you lose the guarantee that generated ids are unique. The Id is in the location header that you get in the response:
|
our concern is to reproduce a sensorthings instance completely, so it needs
to be stateless. We want to generate unique id's in another place of our
pipeline. Do you think you could implement such a feature on request?
2017-11-24 14:34 GMT+01:00 Hylke van der Schaaf <notifications@github.com>:
… Yes, the id is generated by the database. In theory it's possible to allow
user-generated ids, but it's a bad idea, since you lose the guarantee that
generated ids are unique.
The Id is in the location header that you get in the response:
Req 33 - create-update-delete/create-entity
Upon successful completion, the response SHALL contain a HTTP location
header that contains the selfLink of the created entity.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGakdCdhSAqHDYTF4eVc-G4P5K2l_dFSks5s5sX6gaJpZM4Qplcd>
.
--
Dr.rer.nat. Johannes Riesterer
www.buerozwei.com
|
If you're trying to replicate a complete server then it might be a lot easier to make a database dump and import that, or use database replication. When it comes to matching entities across servers it's better to use the metadata fields. You can add an external identifier to the properties of a Thing, and use that to find the correct Thing for your operations. We also have a branch that adds a properties field to all entities, not just Thing and Observation. We can always talk about special feature requests. |
we want to sync the datastream with a Kafka system and we need unique identifiers in order to be able to restore everything from the Kafka system and to introduce redundant systems. |
When synchronising with external systems, the properties fields are the way to go. There you can store any information about the external system that you need. |
ok, thank you very much for your help. Where can i find that build with properties field for all entities? |
In the branch moreProperties, at the following url: |
thank you. In the first instance we can work with this approach. After a long discussion today, we still think that we need to set id's manually later on in the project. Are you interested in a collaboration? |
Dear SensorThings Team,
is it possible to set the id of an object manually at it's creation?
So for example, can i create a Thing with @iot.id': "Some unique identifier"?
Best Regards
Johannes Riesterer
The text was updated successfully, but these errors were encountered: