Expose transient properties via REST V2 API

Hi,

I have a REST V2 API versioning problem. I have some changes in my domain class and a will get an old property. Therefor changed the old property into a new named one. Then I created a transient property which represented the old property and changed the getter and setter implementation.

Now I have the problem to get the property value of the transient field.
Is it possible to expose transient properties via REST V2 API?

Best regards and thanks!
Matthias

2 Likes

Hi Matthias,
We’ll fix it in next bugfix release. Transient fields will be exposed.

Cool thanks.

Hi,

We are using the 6.5.3 version of your platform and it has the same limitation. Which release version are you guys targeting?

Hi,

It works in all latest releases, including 6.5.3.

For example, having a non-persistent attribute named foo:

@Entity(name = "sales$Customer")
public class Customer extends StandardEntity {
    private static final long serialVersionUID = -1591695782019653224L;

    @Column(name = "NAME", nullable = false, length = 100)
    protected String name;

    @Column(name = "EMAIL", length = 100)
    protected String email;

    @MetaProperty
    public String getFoo() {
        return name + " - " + email;
    }

I get the following response from http://localhost:8080/app/rest/v2/entities/sales$Customer:

[
    {
        "_entityName": "sales$Customer",
        "_instanceName": "aaaaaaa1111111",
        "id": "1ab5ce56-8c2f-fef2-3ca3-a2c033f7e3c1",
        "foo": "aaaaaaa1111111 - aaaaaaaaa",
        "name": "aaaaaaa1111111",
        "version": 8,
        "deletedBy": "admin",
        "email": "aaaaaaaaa"
    }
]

Keep in mind that empty values are not returned in JSON, it may be a reason why you don’t see your attribute.