diff --git a/Crx/connection.py b/Crx/connection.py index c6fd61e..16a3184 100644 --- a/Crx/connection.py +++ b/Crx/connection.py @@ -24,6 +24,7 @@ download.jsp?path=%2Fcontent%2Fdam%2Fbeeldbank%2Fvrouw-direct-naar.jpg%2Fjcr%3Ac CRX_SERVER_ROOT = '/crx/server/crx.default/jcr:root/' CRX_QUERY = '/crx/de/query.jsp' WCM_REFERENCES = '/bin/wcm/references.json' +WCM_PAGE_REFERENCES = '/libs/wcm/core/content/reference.json' WCM_REPLICATE = '/bin/replicate.json' WORKFLOW_INSTANCES = '/etc/workflow/instances' @@ -122,6 +123,33 @@ class Connection: }) return response.json()['pages'] + def get_page_references(self, page_path: str): + """ + Check other item are referenced by the current page. + + Args: + page_path: The page to check + + Returns: + A list of dictionaries that represent the referenced items + + Examples: + session.get_page_references('/content/....') + [{ + "type": "asset", + "path": "/content/dam/beeldbank/jong-koppel-leest-liggend-op-de-vloer-met-voeten-op-de-bank.jpg", + "name": "jong-koppel-leest-liggend-op-de-vloer-met-voeten-op-de-bank.jpg", + "published": False, + "outdated": False, + "status": "not available", + "disabled": False, + "lastPublished": 0, + "lastModified": 1552398212196 + }] + """ + response = self._session.get(self._host + WCM_PAGE_REFERENCES, params={'path': page_path}) + return response.json()['assets'] + def upload_asset(self, dam_directory: str, filename: str, data: bytes, content_type: str): """ Upload an asset to the DAM as if it was uploaded through the GUI