developers

No menu items for this category

How to Add a Custom Property to an Entity with API

This tutorial will create a custom property for a table entity.

A custom property can store a value for each entity, such as a table's size for each table entity.

All OpenMetadata APIs are secured so make sure to add the proper headers. API requests can be sent with your JWT token

After the API call, you will get a response like this.

Take note of the id that corresponds to "name": "table" from the above response... 7f0b032f-cdc8-4573-abb0-22165dcd8e07.

OpenMetadata's UI supports three field types:

  • String
  • Markdown
  • Integer

This API call will return available field types, grab the id of the "name": "string" field type. i.e 7531f881-c37c-4e39-9154-4bdf0802e05e

Create a payload using the field type id from the previous step and send a PUT request to the table id from the first request to create the custom property for tables.

Verify the previous step with the following request. Look in "customProperties" for our new property.

Response

So for all table entities, we have a tableSize custom property available now, let’s add the value for it for the raw_product_catalog table.

All the custom properties value for the entity will be stored in the extension attribute.

Let’s assume you have raw_product_catalog table, find it's id with the API call below.

If the table's id was 208598fc-bd5f-458c-bf98-59224e1620c7 and we are adding a value to the custom property for the first time, our PATCH API request will be like this.

When Changing the value of the custom property the request should be like this,

When finished your new custom property should be present and updated for the raw_product_catalog table

Custom property added to table

To finish this tutorial, delete the newly created custom property, tableSize by going to Settings >> Custom Properties >> Tables.

Click Delete Property, then Confirm.

Delete custom property added to table