Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.
Info

RESTfull services are done via Alfresco WebScripts - See all webScripts WebScripts for an Alfresco installation at http://alfresco.server.dk/alfresco/service/index/all

My main interest is working with Document Libraries, the other Alfresco stuff I dont use - that part is in my Atlassian Confluence at www.mos-eisley.dk.

So the most interesting WebScripts seems to be in http://alfresco.mos-eisley.dk/alfresco/service/index/package/org/alfresco/slingshot

Tip

Use http://json.parser.online.fr/ to review and validate returned JSON

Indholdsfortegnelse

Getting a list of sites

Review http://docs.alfresco.com/5.1/pra/1/concepts/pra-request-api-format.html

...

Produces this JSON

Kodeblok
{
   "list":
   {"pagination":
     {"count":10,
      "hasMoreItems":false,
       "totalItems":10,
       "skipCount":0,
       "maxItems":100
     },
     "entries":
       [{"entry":
         {"role":"SiteManager",
          "visibility":"PRIVATE","guid"
          "guid":"317e34c7-bc2f-4cd4-9083-127199718886",
          "description":"Private Familiebiller for Toke, Normann, Anette & Christopher",
          "id":"familie-billeder",
          "title":"Familie Billeder"}
         },
        {"entry":
         {"role":"SiteManager","visibility":"PUBLIC",
          "visibility":"PUBLIC",
          "guid":"55970abc-0e80-4839-bef5-0596b5d8aa76",
          "id":"mc-revyen",
          "title":"MC Revyen"}
         },
        {"entry":
         {"role":"SiteManager","visibility":"PRIVATE",
          "visibility":"PRIVATE",
          "guid":"2ce7267b-7c0e-4a50-93e3-13d13bbad8ce",
          "id":"netic-billeder",
          "title":"Netic Billeder"
         }
        },
        {"entry":
          {"role":"SiteManager",
           "visibility":"PRIVATE",
           "guid":"cf74ce4d-259a-49c6-88fc-3fe36140795c",
           "id":"private",
           "title":"Private"
          }
        },
        {"entry":{"
          {"role":"SiteManager",
           "visibility":"PUBLIC",
           "guid":"b507da0a-4769-4599-a4b9-530e59f18607",
           "id":"public",
           "title":"Public"
          }},{
         },
         {"entry":
           {"role":"SiteManager",
            "visibility":"PUBLIC",
            "guid":"fc3fc77c-e115-4a08-90f6-bb6ec66db1ef",
            "id":"sjov",
            "title":"Sjov"}},{
           }
         },
         {"entry":
           {"role":"SiteManager",
            "visibility":"PUBLIC",
            "guid":"7f5708b2-f299-4d4d-87fc-5e480a162f40",
            "id":"slangereden",
            "title":"Slangereden"
           }
         },
         {"entry":
           {"role":"SiteManager",
            "visibility":"PUBLIC","guid":"b4cff62a
            "guid":"b4cff62a-664d-4d45-9302-98723eac1319",
            "description":"This is a Sample Alfresco Team site.",
            "id":"swsdp",
            "title":"Sample: Web Site Design Project"
           }},{"entry":
         },
         {"entry":
           {"role":"SiteManager",
            "visibility":"PUBLIC",
             "guid":"383d7ec3-8943-4bde-a23b-f468087bb70d",
             "description":"Bare til tests",
             "id":"test","title"
             "title":"Test"
            }
          },
          {"entry":
            {"role":"SiteManager",
             "visibility":"PRIVATE","guid"
             "guid":"2341c4bb-d5b3-4b53-8fb6-c07bd4705742",
             "id":"vita-torbens-billeder",
             "title":"Vita og Torbens billeder"
            }
           }]}}

 


         ]
       }
    }

 

Get a list of Documents from a "root" folder

This is for the "familie-billeder" site, the URL is 

...

Which is fitting to the Gui view for the 4 folders:

Get a list of Documents from a folder

The method is the same, here the folder "Tegneserieforsider"

Kodeblok
curl -u username:password http://alfresco.mos-eisley.dk/alfresco/service/slingshot/doclib/doclist/folders/site/sjov/documentLibrary/Tegneserieforsider
   "contentUrl": "api/node/content/workspace/SpacesStore/713d39d0-4f04-45f4-afd8-a44f1435fb04/Batman%20forsider",
   "contentUrl": "api/node/content/workspace/SpacesStore/c81f6195-21a7-4114-837e-e4590d7ec4b8/Film%20Tegneserier",
   "contentUrl": "api/node/content/workspace/SpacesStore/f9c86b6f-176b-4f14-b55c-d1b62cdcc944/Indiana%20Jones",
   "contentUrl": "api/node/content/workspace/SpacesStore/9a4965b2-1a95-4410-bbf9-bcdec8ed714d/Jurassic%20Park%20And%20The%20Lost%20World",
   "contentUrl": "api/node/content/workspace/SpacesStore/f8e9a26c-31c9-444d-9486-a2d5f89b743c/Nattens%20Ridder%20forsider",
   "contentUrl": "api/node/content/workspace/SpacesStore/ea0c0413-1cb3-4793-8efc-992903e28640/Star%20Wars%201-20%20forsider",
   "contentUrl": "api/node/content/workspace/SpacesStore/518bf3a9-3832-4753-8354-d1ec7e0ccb7f/Star%20Wars%20forsider",
   "contentUrl": "api/node/content/workspace/SpacesStore/2d451550-795e-4860-800f-2527a7fe629e/Thriller",
   "contentUrl": "api/node/content/workspace/SpacesStore/f5ecbf22-05e2-4789-8dbf-8319637ffc67/Vogterne%20forsider",

And one step further down to "Thriller"

Kodeblok
curl -u username:password http://alfresco.mos-eisley.dk/alfresco/service/slingshot/doclib/doclist/folders/site/sjov/documentLibrary/Tegneserieforsider/Thriller | grep contentUrl
   "contentUrl": "api/node/content/workspace/SpacesStore/91743fb5-c967-41dd-8d90-1883922fa21c/Thriller%201.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/7e4f8a49-2446-436b-a6b0-874a2d39dea8/Thriller%2010.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/d7f4258e-b9f6-43de-a09f-debf6750cc93/Thriller%202.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/92ab41a1-3f32-4ca7-82b8-d19ad1a0fbb8/Thriller%203.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/d21501e0-37c7-4feb-8d46-547940b64794/Thriller%204.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/05f63751-61b0-4b05-aead-0ca883f8a786/Thriller%205.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/afe3169d-467d-4c0f-a88f-39b9f55af7d7/Thriller%206.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/8ab811dc-8610-49b8-ae6f-41e28b438f8f/Thriller%207.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/133301aa-d775-42d1-8381-5baa984e644d/Thriller%208.jpg",
   "contentUrl": "api/node/content/workspace/SpacesStore/1d5a60eb-fa33-46bd-894f-2573a03d0ddd/Thriller%209.jpg",

 

Getting Content out

Advarsel

This is Work in progress, not optimal yet...(but it does work)

Kodeblok
curl -u username:password http://alfresco.mos-eisley.dk/alfresco/service/slingshot/node/content/workspace/SpacesStore/afe3169d-467d-4c0f-a88f-39b9f55af7d7/Thriller%206.jpg?a=true > Thriller%206.jpg