Skip to content

Instantly share code, notes, and snippets.

@CesarCapillas
Last active July 20, 2019 18:01
Show Gist options
  • Save CesarCapillas/7a99e3a3e9cb8cde1f4a6f81709be67c to your computer and use it in GitHub Desktop.
Save CesarCapillas/7a99e3a3e9cb8cde1f4a6f81709be67c to your computer and use it in GitHub Desktop.
cmis-browser
#!/bin/bash
export http_proxy=
MYHOST=https://alfrescohost
MYSECR="admin:secret"
if [[ $1 == "-h" ]]; then
echo "Usage: cmis-browser.sh [PATH=] [ACTION=properties|parents|aspects"
echo " cmis-browser.sh"
echo " cmis-browser.sh Sites/swsdp/documentLibrary"
exit 1
fi
if [[ $2 == "" ]]; then
ENCODED=`echo $1 | sed -s 's/ /%20/g'`
curl -s -u $MYSECR -X GET $MYHOST/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/$ENCODED | jq -r '.objects[].object.properties | "\(."cmis:objectId".value) [\(."cmis:objectTypeId".value)] --> \(."cmis:name".value)"'
else
if [[ $2 == "parents" ]]; then
curl -s -u $MYSECR -X GET $MYHOST/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/$1?cmisselector=$2 | jq -r '.[].object.properties | "\(."cmis:objectId".value) --> \(."cmis:name".value) [\(."cmis:objectTypeId".value)]"'
elif [[ $2 == "properties" ]]; then
curl -s -u $MYSECR -X GET $MYHOST/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/$1?cmisselector=$2 | jq -r '.[] | "\(.id) --> \(.value)"'
elif [[ $2 == "aspects" ]]; then
curl -s -u $MYSECR -X GET $MYHOST/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/$1?cmisselector=object | jq -r '.[].aspects.appliedAspects'
else
curl -s -u $MYSECR -X GET $MYHOST/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/$1?cmisselector=$2 | jq '.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment