Support Topics Documentation Slack YouTube Blog

autoload replaced with originSubID

Hi!
I’m just reporting what seems like a bug in the REST system.
Here is a model we have:


{
    "___class" : "Absence",
    "enterprise" : {
        "___class" : "Enterprise"
    },
    "user" : {
        "___class" : "Users",
        "enterprise" : {
            "___class" : "Enterprise"
        }
    }
}

(Hope it’s clear).
Everything is set to “autoload”, so when we retrieve the Absence items via a GET, we should have a list of “Absence” items, each one has a “enterprise” and a “user”, and each “user” has an “enterprise” (which may be different from the Absence Enterprise, but could be the same).
What’s wrong is that the “Enterprise” in the user is not loaded. Instead, we get something like this:


"enterprise" : {
    "__originSubID" : "EE1DF81D-63D6-20D0-FFAB-29F3B5C8DE00"
}

I don’t think it’s the intended behavior. Am I right? If so, you should probably look into that.

Hi Dylan,

This is not a bug. It seems that you’re having the same object somewhere in relation (maybe in a cyclic one), so instead of duplicating it we put these “__originSubId” and “__subId” properties in order to indicate that.
This is done to send less data over the network - but the SDKs automatically handle these properties and transform them into objects.

I see… But I’m using the REST api, not the SDK, so I have to populate these by myself?

Does it account something like the size of the class being loaded? B/c we tried with another class (Address), and it was autoloaded nicely.

These IDs appear when you already have the same object in the response. So you may just look it up there by its ID.

This is not really related to an object size, it is rather a way to reduce the number of duplication in the response and a way to handle cyclic relations (when an object is related to itself either directly or through several other relations).

@mark-piller I’m seeing this __originSubID values all in my JSON data. this is not a feature, this is a bug. My expectation is that my data show up exactly as I modeled it. Anything else is just corrupted data. I’m noticing it also when fetching data from Rest Console. This has been an issue also noted here. Dealing with __objectRef, __arrayRef, __originSubID