# REST and read-only properties

**URL:** https://talk.remobjects.com/t/rest-and-read-only-properties/29353
**Category:** Data Abstract
**Created:** [January 26, 2024, 1:18pm UTC](https://talk.remobjects.com/t/rest-and-read-only-properties/29353 "2024-01-26T13:18:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tobygroves](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tobygroves](https://talk.remobjects.com/u/tobygroves)
#### Post date: [January 26, 2024, 1:18pm UTC](https://talk.remobjects.com/t/rest-and-read-only-properties/29353/1 "2024-01-26T13:18:02Z")

</div>

Another quick REST / HttpAPI question.

It seems that, when defining classes derived from TROComplexType which are used as parameters in my REST methods, any read-only properties are excluded.

As an example, say I’m defining a “customer” class which is used both as a parameter to a PUT method to add a customer and also as a result from a GET method to retrieve a customer.

Now not all fields in this class are “bi-directional”. Some should only be included in the result from the GET method whilst others should only be included in the parameter to the PUT method.

I assumed that this could be dictated by whether the published properties of the class had read/write methods, so any read-only properties would only appear when used as a result and any write-only properties only when used as a parameter.

This appears not to work and, if I remove the write method from a property, rendering it read-only, it disappears completely.

Is this by design? Is there any way I can engineer this type of solution or do I have to use two different classes?

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [January 26, 2024, 1:50pm UTC](https://talk.remobjects.com/t/rest-and-read-only-properties/29353/2 "2024-01-26T13:50:10Z")

</div>

Hi,

> [@tobygroves](#):
>
> Now not all fields in this class are “bi-directional”. Some should only be included in the result from the GET method whilst others should only be included in the parameter to the PUT method.

You can have 2 classes in this case.

> [@tobygroves](#):
>
> Is this by design? Is there any way I can engineer this type of solution or do I have to use two different classes?

properties should be r/w otherwise we can’t initialize class correctly. in case of Code-First, we access to properties via RTTI.
