# Possibility to modify API response for the custom field type

**URL:** https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362
**Category:** Technical Help
**Tags:** plugin, api
**Created:** [March 6, 2023, 4:32pm UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362 "2023-03-06T16:32:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dpetrenko](https://community.baserow.io/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dpetrenko](https://community.baserow.io/u/dpetrenko)
#### Post date: [March 6, 2023, 4:32pm UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/1 "2023-03-06T16:32:36Z")

</div>

Hey. I had a chance to create a custom field type using plugins. I’m wondering is there a way to modify API response for the field which has a custom type? The main idea is to have different values in a database and from UI perspective. I found a way to transform value before saving it into database (prepare\_value\_for\_db) but I didn’t find something like this to transform it before sending API response. Is it even possible? Thanks in advance.

---

<div class="post-metadata">

### Author: ![nigel](https://community.baserow.io/user_avatar/community.baserow.io/nigel/32/51_2.png) [@nigel](https://community.baserow.io/u/nigel)
#### Post date: [March 7, 2023, 7:51am UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/2 "2023-03-07T07:51:27Z")

</div>

Hi this is very possible, you should override the following method on your custom field type and provide your own [DRF serializer](https://www.django-rest-framework.org/api-guide/serializers/):

```auto
    def get_response_serializer_field(self, instance, **kwargs):
        return TODO SOME DRF SERIALIZER

```

Also check out all of our own field types here [backend/src/baserow/contrib/database/fields/field\_types.py · develop · Bram Wiepjes / baserow · GitLab](https://gitlab.com/bramw/baserow/-/blob/develop/backend/src/baserow/contrib/database/fields/field_types.py) and also read look over the available overridable methods with their docs on the FieldType base class here [backend/src/baserow/contrib/database/fields/registries.py · develop · Bram Wiepjes / baserow · GitLab](https://gitlab.com/bramw/baserow/-/blob/develop/backend/src/baserow/contrib/database/fields/registries.py) .

---

<div class="post-metadata">

### Author: ![dpetrenko](https://community.baserow.io/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dpetrenko](https://community.baserow.io/u/dpetrenko)
#### Post date: [March 9, 2023, 8:41am UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/3 "2023-03-09T08:41:41Z")

</div>

Got it. Thanks.  
One las question here Is it possible to extend Baserow native field type with plugin or plugins allow to create new types only?

---

<div class="post-metadata">

### Author: ![nigel](https://community.baserow.io/user_avatar/community.baserow.io/nigel/32/51_2.png) [@nigel](https://community.baserow.io/u/nigel)
#### Post date: [March 9, 2023, 12:14pm UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/4 "2023-03-09T12:14:09Z")

</div>

@dpetrenko it’s definitely possible. From a high level you would:

1. Implement a new field type which extends our built in field type, with your customization implemented as overriden methods built in field type. Crucially you should not change the `type` property on this new class and leave it as being inheritted from the base class/
2. In your apps.py ready method call:

```auto
# in your ready method
registry.unregister(TheBuiltInTypeYouWantToOverride)
registry.register(YourNewOverridenBuiltInType())

```

1. Now, we might add new methods, change existing methods on `TheBuiltInTypeYouWantToOverride` with new releases of Baserow. So you might have to do some work depending on the changes when upgrading your plugin to work with a new version of Baserow.

You would do a conceptually similar process in the frontend registries also.

---

<div class="post-metadata">

### Author: ![dpetrenko](https://community.baserow.io/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dpetrenko](https://community.baserow.io/u/dpetrenko)
#### Post date: [March 10, 2023, 10:36am UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/5 "2023-03-10T10:36:12Z")

</div>

Thanks. What about properties? Is there an option to extend native field type with some custom properties? I’m trying to do something like this with link\_row field and I face an issue “LinkRowField() got an unexpected keyword argument”. database\_linkrowfield table was updated with necessary columns.

---

<div class="post-metadata">

### Author: ![dpetrenko](https://community.baserow.io/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dpetrenko](https://community.baserow.io/u/dpetrenko)
#### Post date: [March 10, 2023, 12:42pm UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/6 "2023-03-10T12:42:19Z")

</div>

The only way I’ve found is using after\_create hook and store additional options in other table. Is there a better solution?

---

<div class="post-metadata">

### Author: ![dpetrenko](https://community.baserow.io/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dpetrenko](https://community.baserow.io/u/dpetrenko)
#### Post date: [March 15, 2023, 4:10pm UTC](https://community.baserow.io/t/possibility-to-modify-api-response-for-the-custom-field-type/2362/7 "2023-03-15T16:10:58Z")

</div>

@nigel Could you help me with the issue? Thanks in advance.
