0

I am using Azure Table Storage Rest Api to Update the entity. If the entity has 5 columns(col1,col2,col3,col4,col5) and I am making a PUT request body something like this.

{"col1":"value"}

The rest of the columns value is set to NULL.

Is there a way to avoid it?

Rocket Singh
  • 469
  • 1
  • 10
  • 22

1 Answers1

2

The reason you're seeing this behavior is because you're performing Update Entity operation which will replaces an entire entity.

If you're only interested in changing just one attribute (property), you need to use Merge Entity operation which updates an existing entity by updating the entity's properties. It does not replace the existing entity.

Simply changing your HTTP Request method to MERGE from PUT should do the trick.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • I do not see the Merge Property in HTTPMETHOD. :( – Rocket Singh Jul 27 '20 at 06:47
  • Interesting answer because thats not what docs says. Im facing the same issue i'll try merge now . --- This is what doc say on update : Table Storage doesn't persist null values for properties. Specifying a property with a null value is equivalent to omitting that property in the request. – BorisD Jan 30 '23 at 12:24
  • Ok but docs also says this : The Update Entity operation replaces the entire entity, and you can use the operation to remove properties. – BorisD Jan 30 '23 at 12:27