Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To get the documentUID from the document's path, you can run a http POST against the Document.Fetch endpoint of the DMS:

Code Block
curl \
	-H "authorization: Basic <userAndPassEncoded>" \
	-H "Content-Type: application/json" \
	-d "{\"params\":{\"value\":\"/default-domain/workspaces/Patricia/<documentPath>/<documentName>\"}}" -X POST http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Document.Fetch
 
 
curl \
	-X POST \
  http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Document.Fetch \
  -H 'authorization: Basic <userAndPassEncoded>' \
  -H 'content-type: application/json' \
  -d '{"params":{"value":"/default-domain/workspaces/Patricia/<documentPath>/<documentName>"}}'

Here, the <userAndPassEncoded> represents a Base64 encoded string of the format 'Username:Password'. So, 'Username:Password' would be represented as 'VXNlcm5hbWU6UGFzc3dvcmQ='.

...

This can be curled as http POST against the DMS as follows:

Code Block
curl \
	-H "authorization: Basic <userAndPassEncoded>" \
	-H "Content-Type: application/json" \
	-d "{\"params\":{\"entity-type\":\"document\",\"type\":\"File\",\"name\":\"testdoc.txt\",\"properties\":{\"dc:title\":\"testdoc.txt\",\"pifile:docCategoryId\":\"1\"}},\"input\":\"/default-domain/workspaces/Patricia/<documentPath>\"}" -X POST http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Document.Create
 
 
curl \
	-X POST \
  http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Document.Create \
  -H 'authorization: Basic <userAndPassEncoded>' \
  -H 'content-type: application/json' \
  -d '{"params":{"entity-type":"document","type":"File","name":"<docName>","properties":{"dc:title":"<docName>","pifile:docCategoryID":"<categoryID>"}},"input":"/default-domain/workspaces/Patricia/<documentPath>"}'

Again, the <userAndPassEncoded> represents a Base64 encoded string of the format 'Username:Password'. So, 'Username:Password' would be represented as 'VXNlcm5hbWU6UGFzc3dvcmQ='.

...

This can be curled as http POST against the DMS as follows:

Code Block
curl -X POST \
  http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Blob.Attach \
  \
	-H '"authorization: Basic <userAndPassEncoded>'" \
  	-H '"content-type: application/json'" \
  	-F '"{\"params\":{\"mime-type\":\"<docMimeType>\",\"document\":\"/default-domain/workspaces/Patricia/<documentPath>/<docName>\",\"save\":\"true\",\"xpath\":\"file:content\"}}'" \
  	-F =@/<pathToSourceFile>
	-X POST http://<nuxeoserverip>:<nuxeoport>/nuxeo/api/v1/automation/Blob.Attach \

The <mimeType> should be set according to the document type (eg. "text/html" for a html document). <pathToSourceFile> is your local file path of the binary document to upload.

...