Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sphere.io custom fields on objects

On Sphere.io, I know it is possible to attach custom data to Product objects, using the custom attributes.

Is it possible to do something similar with the Customer and Order objects? Just untyped key-value String pairs would be fine for my scenario (For now, anyway. Later I might need to attach JSON documents).

If yes, is it also possible to filter the objects based on the custom data?

I am using the Sphere Java SDK.

like image 551
Martin Konicek Avatar asked Jan 13 '23 15:01

Martin Konicek


1 Answers

Custom objects API is a simple key-value store that can be used to extend objects such as customer or order with custom JSON documents. If you wanted to attach a birthday to a customer, you could implement it with a custom object where the container could be called "customer-birthdays" and the key would be the id of the customer. Every time you would load a customer object and you would require the birthday, you would have to fetch it using it's id from the key-value store.

The SPHERE.IO backend does not know anything about the associations between a customer and it's birthday. This means that when querying customers it is not possible to include the attached birthday in the query predicate.

The custom objects API is also exposed in the Java SDK.

like image 105
GregOr Avatar answered Jan 21 '23 14:01

GregOr