<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bad upload using REST API and batch in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316357#M3358</link>
    <description>&lt;P&gt;Merci beaucoup&lt;/P&gt;
&lt;P&gt;et ... désolé pour le dérangement ... que j'aurais pu éviter en relisant mieux!!!&lt;/P&gt;
&lt;P&gt;Cordialement
Christian&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2014 12:42:35 GMT</pubDate>
    <dc:creator>Arnault_</dc:creator>
    <dc:date>2014-04-01T12:42:35Z</dc:date>
    <item>
      <title>Bad upload using REST API and batch</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316355#M3356</link>
      <description>&lt;P&gt;Bonjour&lt;/P&gt;
&lt;P&gt;J'utilise la batch pour effectuer un upload :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;curl -H "X-Batch-Id: mybatchid" -H "X-File-Idx:xxx.pdf" -H "X-File-Name:0" -F file=@xxx.pdf -u Administrator:Administrator &lt;A href="http://localhost:8080/nuxeo/api/v1/automation/batch/upload" target="test_blank"&gt;http://localhost:8080/nuxeo/api/v1/automation/batch/upload&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ce qui fournit l'information du batch:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[{"name":"xxx.pdf","size":291936}]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ensuite j'installe un premier fichier dans mon document en tant que "file-content":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;id="8283131e-d835-4648-9bac-6a662af950f5"
curl -X PUT -H "Content-Type: application/json" -u Administrator:Administrator -d "{ \"entity-type\": \"document\", \"repository\": \"default\", \"uid\":\"%id%\", \"properties\" : { \"file:content\": {\"name\":\"xxx.pdf\", \"upload-batch\":\"mybatchid\",\"upload-fileId\":\"0\"} } }" "http://localhost:8080/nuxeo/api/v1/id/%id%"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ce qui est correct (résult du GET):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{..., "file:content":{"name":"xxx.pdf","mime-type":"application/pdf","encoding":null,"digest":"006772381d75eb52a232d3e08611ae5b","length":"291936","data":"files/8283131e-d835-4648-9bac-6a662af950f5?path=%2Fcontent"}...}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Ensuite je veux installer un autre fichier joint&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;curl -H "X-Batch-Id: mybatchid" -H "X-File-Idx:xxx.pptx" -H "X-File-Name:xxx.pptx" -F file=@xxx.pptx -u Administrator:Administrator &lt;A href="http://localhost:8080/nuxeo/api/v1/automation/batch/upload" target="test_blank"&gt;http://localhost:8080/nuxeo/api/v1/automation/batch/upload&lt;/A&gt;
curl -X GET &lt;A href="http://localhost:8080/nuxeo/api/v1/automation/batch/files/mybatchid" target="test_blank"&gt;http://localhost:8080/nuxeo/api/v1/automation/batch/files/mybatchid&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ce qui fournit l'information du batch:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[{"name":"xxx.pptx","size":291048}]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;avec l'installation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;curl -X PUT -H "Content-Type: application/json" -u Administrator:Administrator -d "{ \"entity-type\": \"document\", \"repository\": \"default\", \"uid\":\"%id%\", \"properties\" : { \"files:files\": [ { \"file\": {\"name\":\""xxx.pptx"\", \"mime-type\":\"application/vnd.openxmlformats-officedocument.presentationml.presentation\" , \"length\":\"291048\", \"upload-batch\":\"mybatchid\", \"upload-fileid\":\"0\" }, \"filename\":\""xxx.pptx"\", \"length\":\"291048\" } ] } }" "http://localhost:8080/nuxeo/api/v1/id/%id"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Mais qui ne fonctionne pas (aucune erreur):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{... "properties":{..."files:files":[{"file":null,"filename":"xxx.pptx"}]...}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bien sûr si j'installe manuellement mon fichier via l'interface graphique, j'obtiens le bon résultat par GET:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{..."properties":{..."files:files":[{"file":{"name":"xxx.pptx","mime-type":"application/vnd.openxmlformats-officedocument.presentationml.presentation","encoding":null,"digest":"38a5173d02640809cae56ba36cd023d9","length":"291048","data":"files/8283131e-d835-4648-9bac6a662af950f5?path=%2Ffiles%2Fitem%5B0%5D%2Ffile"},"filename":"xxx.pptx"}]}}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ma configuration Nuxeo:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;studio     started      atrium (id: atrium-0.0.0-SNAPSHOT)
hotfix     started      nuxeo-5.8.0-HF01 (id: nuxeo-5.8.0-HF01-1.0.0)
hotfix     started      nuxeo-5.8.0-HF02 (id: nuxeo-5.8.0-HF02-1.0.0)
hotfix     started      nuxeo-5.8.0-HF03 (id: nuxeo-5.8.0-HF03-1.0.0)
hotfix     started      nuxeo-5.8.0-HF04 (id: nuxeo-5.8.0-HF04-1.0.0)
hotfix     started      nuxeo-5.8.0-HF05 (id: nuxeo-5.8.0-HF05-1.0.0)
hotfix     started      nuxeo-5.8.0-HF06 (id: nuxeo-5.8.0-HF06-1.0.0)
hotfix     started      nuxeo-5.8.0-HF07 (id: nuxeo-5.8.0-HF07-1.0.0)
hotfix     started      nuxeo-5.8.0-HF08 (id: nuxeo-5.8.0-HF08-1.0.0)
hotfix     started      nuxeo-5.8.0-HF09 (id: nuxeo-5.8.0-HF09-1.0.0)
 addon     started      in2p3-atrium (id: in2p3-atrium-1.1.5)
 addon     started      nuxeo-dm (id: nuxeo-dm-5.9.2)
 addon     started      nuxeo-drive (id: nuxeo-drive-1.3.2)
 addon     started      nuxeo-rest-api (id: nuxeo-rest-api-5.8.0)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Qui peut m'aider à trouver l'erreur?&lt;/P&gt;
&lt;P&gt;Cordialement
Christian&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 11:01:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316355#M3356</guid>
      <dc:creator>Arnault_</dc:creator>
      <dc:date>2014-03-31T11:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Bad upload using REST API and batch</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316356#M3357</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;What is used in your curl command is:&lt;/P&gt;
&lt;P&gt;"-H X-File-Idx:xxx.pdf" -H "X-File-Name:0"&lt;/P&gt;
&lt;P&gt;While it should be "-H X-File-Idx:0" -H "X-File-Name:xxx.pdf"&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 21:44:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316356#M3357</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2014-03-31T21:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Bad upload using REST API and batch</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316357#M3358</link>
      <description>&lt;P&gt;Merci beaucoup&lt;/P&gt;
&lt;P&gt;et ... désolé pour le dérangement ... que j'aurais pu éviter en relisant mieux!!!&lt;/P&gt;
&lt;P&gt;Cordialement
Christian&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 12:42:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/bad-upload-using-rest-api-and-batch/m-p/316357#M3358</guid>
      <dc:creator>Arnault_</dc:creator>
      <dc:date>2014-04-01T12:42:35Z</dc:date>
    </item>
  </channel>
</rss>

