nikita_1608
8 years agoGuide
Delete images from users album?
Hi, I want to delete all the images from a users album(media/gallerypage). Is there any api for the same, because my data is quite large, more than 10000 images. If not api, would there be an a...
- 8 years ago
Hope this will help -
You need to fetch the images of a user by the following call. https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=images#constraints-owner.id
SELECT id FROM images WHERE owner.id = '<user.id>'
You will get the image id by above call.
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "images", "list_item_type" : "image", "size" : 1, "items" : [ { "type" : "image", "id" : "76iBED800BDCBFA6DE9" } ] }, "metadata" : { } }
Pass the image id to below call to delete that image. This need to be done in a loop to delete all the images.
jQuery.ajax({ url: 'http://grazitti2.demo.lithium.com/grazitti2/api/2.0/images/<image.id>', type: 'DELETE', success: function(result) { console.log(result); } });