More in this section

Forums / Developing with Sitefinity / Use WCF for create a News

Use WCF for create a News

3 posts, 0 answered
  1. Alex
    Alex avatar
    5 posts
    03 Nov 2011
    11 Nov 2011
    Link to this post

    How can I use ~/sitefinity/Services/Content/NewsItemmService.svc
    for create and update a news?

    Your WCF client example (VS 2010 solution) conyains only list and delete news methods.
    The documentation on this is pretty useless.
    How do I know which fields are required in the passed JSON?
    And how do I know what values ​​I can / should I use?
    How can I publish/unpublish the news?

    Besides the 4.1 SP2 I was able to insert a news (in the draft and was blocked by the user),
    but the same code no longer works on 4.3, despite the inclusion of various {"PersistedValue": "my string","Value": "my string"} instead of simple strings.
    I am using this JSON:

            "AvailableLanguages": ["it"],
            "PublicationDate": "\/Date(1321007676307)\/" ,
            "Title":{"PersistedValue": "Test 1", "Value": "Test 1" },
            "UrlName":{"PersistedValue": "Test-1", "Value":"Test-1" }, 
            "Author":{"PersistedValue": "Test page", "Value":"Test page" },
            "Content":{"PersistedValue": "Lorem ipsum...", "Value":"Lorem ipsum..." },
            "Summary":{"PersistedValue": "", "Value":"" } 


    And the error (not present in previous Sitefinity version) is:
    String was not recognized as a valid Boolean.

    Where can I see a working example?

  2. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    13 Aug 2010
    14 Nov 2011
    Link to this post
    I would also like to see some answers on this question.
  3. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    24 Sep 2012
    15 Nov 2011
    Link to this post
    Hi guys,

     I'm attaching an example of creating a News Item, using Sitefinity's services. Mind that you have to specify credentials of a user that has create/edit permissions for news items, so that the service can be consumed. You can also check this blog post for more general information on Sitefinity's RESTful services:
    Considering the required fields - they are the same as they would be if you created a NewsItem from the backend. It should have a Title, UrlName, Content, PublicationDate and an Author. Considering the error that is thrown to you, I think the reason is this line:


    Please check the example which shows how to log in Sitefinity and consume the service for creating a NewsItem. You can find all the documentation link and how to make use of the service's help page in the blogpost link above.
    Let me know if you have further problems with this.

    Svetoslav Petsov
    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
3 posts, 0 answered