Blob.AttachOnDocument Rest API

Hi,

I can't attach blob to a document using REST API. To debug I decided to try with the demo web interface. I also get a 404 error code response. __com.sun.jersey.api.NotFoundException: null for uri: http://demo.nuxeo.com/nuxeo/site/automation/batch/execute

Here is the the curl request :

curl -X POST 'https://demo.nuxeo.com/nuxeo/site/automation/batch/execute' -H 'Nuxeo-Transaction-Timeout: 3' -H 'X-NXproperties: *' -H 'X-NXRepository: default' -H 'X-NXVoidOperation: false' -H 'content-type: application/json' -d '{“params”:{“document”:“854e5731-c792-4a1a-8945-4b310581c9e2”,“save”:“true”,“xpath”:“files”,“operationId”:“Blob.AttachOnDocument”,“batchId”:“batchId-ca3b5737-bb41-484a-bd3c-72676f3ddecc”},“context”:{}}' -u Administrator:

Any help is welcome ! Thanks in advance

0 votes

1 answers

143 views

ANSWER



Have you tried this? After you have your batch id, replace that below, and of course your own URL.

Create a new document with the blob: curl -X POST -d '{“entity-type”:“document”,“name”:“TestFile”,“type”:“File”,“properties”:{“file:content”:{ “upload-batch”: “batchId-yourbatchid”,“upload-fileId”: “0”}}} ' -H “Content-Type:application” -i http://localhost.com:8080/nuxeo/api/v1/path/default-domain/ -u Administrator

Or update an existing document with the blob: curl -X PUT -d '{“entity-type”:“document”,“name”:“Your Document Name”,“type”:“File”,“properties”:{“file:content”:{ “upload-batch”: “batchId-yourbatchid”,“upload-fileId”: “0”}}} ' -H “Content-Type:application” -i http://localhost.com:8080/nuxeo/api/v1/id/854e5731-c792-4a1a-8945-4b310581c9e2 -u Administrator

0 votes