More in this section

Forums / General Discussions / Uploading Documents via "DocumentService.svc"

Uploading Documents via "DocumentService.svc"

2 posts, 0 answered
  1. Richard
    Richard avatar
    15 posts
    Registered:
    17 Aug 2012
    06 Jun 2011
    Link to this post
    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!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    08 Jun 2011
    Link to this post
    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
2 posts, 0 answered