Uploading Documents via "DocumentService.svc"

Posted by Community Admin on 03-Aug-2018 22:19

Uploading Documents via "DocumentService.svc"

All Replies

Posted by Community Admin on 06-Jun-2011 00:00

Hello,

I am having some issues understanding how to upload documents via the DocumentService. I have got past the initial authentication issues I saw others were having.

I would be grateful if you could advice me on how to save content. From what I understand, I should use the "SaveContent" method. However, I have two questions:

1. How do I add actual binary content to the SaveContent method (I don't see anywhere in the JSON example data that allows me to do this).
2. Do I need to specify all of the parameters when creating the content, or can I specify just a few?

Thanks,
Richard Bosworth

P.S. I am absolutely loving Sitefinity so far!

Posted by Community Admin on 08-Jun-2011 00:00

Hi Richard,

Actually the better option is using SaveChildContent. The problem here is that the content item is created through the service, but the actual data is uploaded by the LibraryHttpHandler which means that there is no binaryinfo in the json. SaveContent and SaveChildContent expects ContentItemContext<TContent> which is passed as a context and then we get the data item from the ContentItemContext<TContent>, but for library items this happens in the handler. What I can suggest is using a RPC. For example you can create a web service that uses our API  for creating media items and then request the service from your application

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed