Skip to content

Use Media

aureldent edited this page Oct 17, 2019 · 2 revisions

Media Snippets

Change media visibility

#Python2.7
from lumapps.api import ApiClient
import json 

token = "token here"
INSTANCE_ID = "ID Here"
api = ApiClient(token=token)


# Get a list of files from the media library for the target instance
# this example returns 30 files
body = {
  "maxResults": 30,
  "more": True,
  "lang": "en",
  "docPath": "provider=local/site=" + INSTANCE_ID,
  "searchParameters": {
    "shared": True,
    "trashed": False
  },
  "sortOrder": [],
  "searchTypes": [
    "FOLDER",
    "IMAGE",
    "OTHER"
  ]
}

documents = api.iter_call("document", "list", body=body)


for document in documents:
    # Set isShared to False so it can be removed from the media library
    # And displayed only in the media author library
    document['isShared'] = False
    update = api.get_call("document", "update", body=document)
Clone this wiki locally