cancel
Showing results for 
Search instead for 
Did you mean: 

problem with uploading file using rest api

Uril_Yak
Champ on-the-rise
Champ on-the-rise

I have problem with uploading file with rest api using coldfusion language. At the first I tried using postman and it's working.

For example first I sent http request to create batchId

And I got a response a new batch id created: batchId-88c6a627-4718-4630-be77-2fe857d69eac

Second I send rest api request to upload file, in my case file is C:\Users<myname>\Documents\nuxeo\B501B5B3-7090-4064-BDF5-58EA18812E9C\8F8A67A2-8E60-43FA-A3F1-8E18E0AE8B96\Accounts\Account_two.pdf <cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("#application.NUXEO_USER_NAME#:#application.NUXEO_PASSWORD#")#" />

and I got the following response:

{"uploaded":"true","fileIdx":"0","uploadType":"normal","uploadedSize":"3028","batchId":"batchId-88c6a627-4718-4630-be77-2fe857d69eac"}

I don't now why I got response?

Finaly I sent the rest api request to bind my file to the document:

<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" } } }>

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"] }

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.

1 REPLY 1

Uril_Yak
Champ on-the-rise
Champ on-the-rise

When I uploaded a file I got a response with html tag. May be this is the problem?

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.