File upload in Javascript with REST API

Hello,

I use the automation API in javascript and I have to upload a file. It works well with browsers that support XMLHttpRequest Level 2 but not with others as IE 8.

In this case, I use an iframe … and I have this:

Request

`Request URL: http://localhost:8080/nuxeo/site/automation/Blob.Attach

Request Headers :

Accept: text / html, application / xhtml + xml, application / xml; q = 0.9, * / * q = 0.8
Content-Type: application / x-www-form-urlencoded
Origin: http://localhost:8080
Referer: http://localhost:8080/nuxeo/site/pac/live-edit
User-Agent: Mozilla/5.0 (X11 Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Safari/537.11 Chrome/23.0.1271.97


Form Dataview URL encoded :
jsondata: {“params”: {“document”: “4e2187b4-ecad-A01B-4bfe-4f6ede7d9a46”}, “context”: {}}
file: Eclipse-logo_small.jpg`

Response

Caused by: org.nuxeo.ecm.automation.InvalidChainException: Can not find any valid path in operation chain
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.buildChain (CompiledChainImpl.java: 147)
at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.compileChain (OperationServiceImpl.java: 207)
at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.compileChain (OperationServiceImpl.java: 200)
at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run (OperationServiceImpl.java: 81)
at org.nuxeo.ecm.automation.server.jaxrs.OperationResource.execute (OperationResource.java: 42)
at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost (ExecutableResource.java: 56)

I don't understand when I do a GET operation Blob.Attach, I have a response from the server with the description of the operation

0 votes

0 answers

2103 views

ANSWER