Uploading Documents via "DocumentService.svc"
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!
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