This is a migrated thread and some comments may be shown as answers.

remove/unset field

2 Answers 39 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Francesco
Top achievements
Rank 1
Francesco asked on 19 Jul 2016, 08:28 AM

Hi,

is there a way to remove/unset a field from DB?

If i remove a field in the content type structure (Edit Structure), these fields remain and appear under label: "Fields that are not defined in the structure".

I checked the API documentation but I found nothing for this.

Thanks,

Francesco.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Dimitrov
Telerik team
answered on 19 Jul 2016, 12:25 PM
Hi Francesco,

The desired functionality is indeed possible, but no mentioned in the docs at the moment. You just have to issue an update request to your content type with the following body:

PUT: https://api.everlive.com/v1/Your_Api_Key/Your_Content_Type
Body:
{
   "$unset": {"my-field-name": "" }
}

This request will remove the field "my-field-name" from all items. You can also specify a filter in order to remove the field only from items that match a certain condition (using the X-Everlive-Filter header or the filtering methods in each SDK).  

Additionally if you want to have the field completely removed, you have to delete it from your content type structure as well.

Hope this information will help you.

Regards,
Dimitar Dimitrov
Telerik by Progress
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Francesco
Top achievements
Rank 1
answered on 20 Jul 2016, 04:25 PM

Hi Dimitar and thanks for your help.
I've tested (with Postman) your solution, it works fine.

Thanks,
Francesco

Tags
General Discussion
Asked by
Francesco
Top achievements
Rank 1
Answers by
Dimitar Dimitrov
Telerik team
Francesco
Top achievements
Rank 1
Share this question
or