<?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 problem with uploading file using rest api in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/problem-with-uploading-file-using-rest-api/m-p/322742#M9743</link>
    <description>&lt;P&gt;I  have problem with uploading file with rest api using coldfusion language.
At the first I tried using postman and it's working.&lt;/P&gt;
&lt;P&gt;For example first I sent http request to create batchId&lt;/P&gt;
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult" timeout="60"&gt;
	&lt;CFHTTPPARAM type="header" name="Authorization" value="Basic #ToBase64("&gt;&lt;/CFHTTPPARAM&gt;
&lt;/CFHTTP&gt;
&lt;P&gt;And I got a response a new batch id created:
batchId-88c6a627-4718-4630-be77-2fe857d69eac&lt;/P&gt;
&lt;P&gt;Second I send rest api request to upload file, in my case file is C:\Users&amp;lt;myname&amp;gt;\Documents\nuxeo\B501B5B3-7090-4064-BDF5-58EA18812E9C\8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96\Accounts\Account_two.pdf
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult"&gt;
&amp;lt;cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("#application.NUXEO_USER_NAME#:#application.NUXEO_PASSWORD#")#" /&amp;gt;
&lt;CFHTTPPARAM type="header" name="X-File-Name" value="Account_two.pdf"&gt;&lt;/CFHTTPPARAM&gt;
&lt;CFHTTPPARAM type="header" name="X-File-Type" value="application/pdf"&gt;&lt;/CFHTTPPARAM&gt;
&lt;CFHTTPPARAM file="C:\Users\&amp;lt;myname&amp;gt;\Documents\nuxeo\B501B5B3-7090-4064-BDF5-58EA18812E9C\8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96\Accounts\Account_two.pdf" name="Account_two" mimetype="application/pdf" type="file"&gt;
&lt;/CFHTTPPARAM&gt;&lt;/CFHTTP&gt;&lt;/P&gt;
&lt;P&gt;and I got the following response:&lt;/P&gt;
{"uploaded":"true","fileIdx":"0","uploadType":"normal","uploadedSize":"3028","batchId":"batchId-88c6a627-4718-4630-be77-2fe857d69eac"} 
&lt;P&gt;I don't now why I got  response?&lt;/P&gt;
&lt;P&gt;Finaly I sent the rest api request to bind my file to the document:&lt;/P&gt;
&lt;P&gt;&amp;lt;cfset stFields = {
"entity-type": "document",
"name":"Account_two.pdf",
"type": "File",
"properties": {
"dc:title": "Account_two.pdf",
"dc:description": "Created via a REST API",
"file:content": {
"upload-batch":"batchId-88c6a627-4718-4630-be77-2fe857d69eac",
"upload-fileId":"0"
}
}
}&amp;gt;&lt;/P&gt;
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult" timeout="60"&gt;
			&lt;CFHTTPPARAM type="header" name="Authorization" value="Basic #ToBase64("&gt;&lt;/CFHTTPPARAM&gt;
			&lt;CFHTTPPARAM type="header" name="Content-Type" value="application/json"&gt;&lt;/CFHTTPPARAM&gt;
			&lt;CFHTTPPARAM type="body" value="#serializeJSON(stFields)#"&gt;
&lt;/CFHTTPPARAM&gt;
&lt;P&gt;and I got a response:
{"entity-type":"document",
"repository":"default",
"uid":"2b85ebd6-492a-461d-a288-94a85bc09f9c",
"path":"/default-domain/workspaces/B501B5B3-7090-4064-BDF5-58EA18812E9C/8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96/Account_two.pdf",
"type":"File",
"state":"project",
"parentRef":"351354ec-83e6-491d-a4a0-d010873d74ec",
"isCheckedOut":true,
"isVersion":false,
"isProxy":false,
"changeToken":"0-0",
"title":"Account_two.pdf",
"lastModified":"2018-05-14T14:00:09.902Z",
"facets":["Versionable","NXTag","Publishable","Commentable","HasRelatedText","Downloadable"]
}&lt;/P&gt;
&lt;P&gt;Problem is that document is created, but I don't see that file which I upload previously has not been attached to the document.
Any help will be appreciated.&lt;/P&gt;&lt;/CFHTTP&gt;</description>
    <pubDate>Mon, 14 May 2018 14:38:21 GMT</pubDate>
    <dc:creator>Uril_Yak</dc:creator>
    <dc:date>2018-05-14T14:38:21Z</dc:date>
    <item>
      <title>problem with uploading file using rest api</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/problem-with-uploading-file-using-rest-api/m-p/322742#M9743</link>
      <description>&lt;P&gt;I  have problem with uploading file with rest api using coldfusion language.
At the first I tried using postman and it's working.&lt;/P&gt;
&lt;P&gt;For example first I sent http request to create batchId&lt;/P&gt;
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult" timeout="60"&gt;
	&lt;CFHTTPPARAM type="header" name="Authorization" value="Basic #ToBase64("&gt;&lt;/CFHTTPPARAM&gt;
&lt;/CFHTTP&gt;
&lt;P&gt;And I got a response a new batch id created:
batchId-88c6a627-4718-4630-be77-2fe857d69eac&lt;/P&gt;
&lt;P&gt;Second I send rest api request to upload file, in my case file is C:\Users&amp;lt;myname&amp;gt;\Documents\nuxeo\B501B5B3-7090-4064-BDF5-58EA18812E9C\8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96\Accounts\Account_two.pdf
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult"&gt;
&amp;lt;cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("#application.NUXEO_USER_NAME#:#application.NUXEO_PASSWORD#")#" /&amp;gt;
&lt;CFHTTPPARAM type="header" name="X-File-Name" value="Account_two.pdf"&gt;&lt;/CFHTTPPARAM&gt;
&lt;CFHTTPPARAM type="header" name="X-File-Type" value="application/pdf"&gt;&lt;/CFHTTPPARAM&gt;
&lt;CFHTTPPARAM file="C:\Users\&amp;lt;myname&amp;gt;\Documents\nuxeo\B501B5B3-7090-4064-BDF5-58EA18812E9C\8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96\Accounts\Account_two.pdf" name="Account_two" mimetype="application/pdf" type="file"&gt;
&lt;/CFHTTPPARAM&gt;&lt;/CFHTTP&gt;&lt;/P&gt;
&lt;P&gt;and I got the following response:&lt;/P&gt;
{"uploaded":"true","fileIdx":"0","uploadType":"normal","uploadedSize":"3028","batchId":"batchId-88c6a627-4718-4630-be77-2fe857d69eac"} 
&lt;P&gt;I don't now why I got  response?&lt;/P&gt;
&lt;P&gt;Finaly I sent the rest api request to bind my file to the document:&lt;/P&gt;
&lt;P&gt;&amp;lt;cfset stFields = {
"entity-type": "document",
"name":"Account_two.pdf",
"type": "File",
"properties": {
"dc:title": "Account_two.pdf",
"dc:description": "Created via a REST API",
"file:content": {
"upload-batch":"batchId-88c6a627-4718-4630-be77-2fe857d69eac",
"upload-fileId":"0"
}
}
}&amp;gt;&lt;/P&gt;
&lt;CFHTTP url="#arguments.urlPath#" method="post" result="restResult" timeout="60"&gt;
			&lt;CFHTTPPARAM type="header" name="Authorization" value="Basic #ToBase64("&gt;&lt;/CFHTTPPARAM&gt;
			&lt;CFHTTPPARAM type="header" name="Content-Type" value="application/json"&gt;&lt;/CFHTTPPARAM&gt;
			&lt;CFHTTPPARAM type="body" value="#serializeJSON(stFields)#"&gt;
&lt;/CFHTTPPARAM&gt;
&lt;P&gt;and I got a response:
{"entity-type":"document",
"repository":"default",
"uid":"2b85ebd6-492a-461d-a288-94a85bc09f9c",
"path":"/default-domain/workspaces/B501B5B3-7090-4064-BDF5-58EA18812E9C/8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96/Account_two.pdf",
"type":"File",
"state":"project",
"parentRef":"351354ec-83e6-491d-a4a0-d010873d74ec",
"isCheckedOut":true,
"isVersion":false,
"isProxy":false,
"changeToken":"0-0",
"title":"Account_two.pdf",
"lastModified":"2018-05-14T14:00:09.902Z",
"facets":["Versionable","NXTag","Publishable","Commentable","HasRelatedText","Downloadable"]
}&lt;/P&gt;
&lt;P&gt;Problem is that document is created, but I don't see that file which I upload previously has not been attached to the document.
Any help will be appreciated.&lt;/P&gt;&lt;/CFHTTP&gt;</description>
      <pubDate>Mon, 14 May 2018 14:38:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/problem-with-uploading-file-using-rest-api/m-p/322742#M9743</guid>
      <dc:creator>Uril_Yak</dc:creator>
      <dc:date>2018-05-14T14:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: problem with uploading file using rest api</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/problem-with-uploading-file-using-rest-api/m-p/322743#M9744</link>
      <description>&lt;P&gt;When I uploaded a file I got a response with html tag. May be this is the problem?&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:44:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/problem-with-uploading-file-using-rest-api/m-p/322743#M9744</guid>
      <dc:creator>Uril_Yak</dc:creator>
      <dc:date>2018-05-14T14:44:11Z</dc:date>
    </item>
  </channel>
</rss>

