Skip to content

Instantly share code, notes, and snippets.

@CesarCapillas
Last active July 20, 2019 18:01
Show Gist options
  • Select an option

  • Save CesarCapillas/7a99e3a3e9cb8cde1f4a6f81709be67c to your computer and use it in GitHub Desktop.

Select an option

Save CesarCapillas/7a99e3a3e9cb8cde1f4a6f81709be67c to your computer and use it in GitHub Desktop.

Revisions

  1. CesarCapillas renamed this gist Jul 20, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. CesarCapillas created this gist Jul 20, 2019.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/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