+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Reading custom modules using REST API

Reading custom modules using REST API

4 posts, 1 answered
  1. Balanjaneyulu
    Balanjaneyulu avatar
    35 posts
    Registered:
    11 Feb 2016
    27 May
    Link to this post
    Hi everyone,


    Can someone explain to me How can I get the dynamic module names using the available rest API or the usage of

    GET /restapi/sitefinity/related-data/data-types.


    Thanks,
    Balu
    Answered
  2. Dimitri Cools
    Dimitri Cools avatar
    80 posts
    Registered:
    30 Sep 2016
    31 May
    Link to this post
    Hi, 
    Could you please elaborate on what you are trying to achieve in the end ? 
     
    You can also use the ContentTypeService.svc directly, 
    eg.
    http://<yourhost>:<yourport>/Sitefinity/Services/DynamicModules/ContentTypeService.svc/
     
    which returns, amongst others, the ContentTypeTitle.
     
    Additional doc links:
     
    Create a RESTful WCF service to retrieve titles of news items
     
    Related data API


    Regards,
    Dimitri Cools
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Balanjaneyulu
    Balanjaneyulu avatar
    35 posts
    Registered:
    11 Feb 2016
    02 Jun in reply to Dimitri Cools
    Link to this post

    Hi Dimitri,

    Thank you. I am trying to read the all dynamic modules which are available in Sitefinity using angular JS.
    I was using http://localhost:60876/restapi/sitefinity/related-data/data-types to get the all modules which are available.
    Once I hit the above URL, I am getting a web page as a response and a hyper link(view json datasource). On clicking hyperlink, it is giving JSON response.


    Please find the attached snapshot which I get after hitting the response.

    Sample JSON Response:

    [{"ClrType":"Telerik.Sitefinity.News.Model.NewsItem","Name":"News","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default News"}]},{"ClrType":"Telerik.Sitefinity.Blogs.Model.BlogPost","Name":"Blog Posts","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Blogs"}]},{"ClrType":"Telerik.Sitefinity.Events.Model.Event","Name":"Events","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Events"}]},{"ClrType":"Telerik.Sitefinity.Pages.Model.PageNode","Name":"Pages","ParentName":"Page","Providers":[{"Name":"OpenAccessDataProvider","Title":"OpenAccessDataProvider"}]},{"ClrType":"Telerik.Sitefinity.DynamicTypes.Model.Bala.Balu","Name":"BAlus (Bala)","ParentName":"Bala","Providers":[{"Name":"OpenAccessProvider","Title":"Default"}]},{"ClrType":"Telerik.Sitefinity.DynamicTypes.Model.sf_ec_prdct_book","Name":"Book","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Ecommerce products"}]},{"ClrType":"Telerik.Sitefinity.DynamicTypes.Model.sf_ec_prdct_generalproduct","Name":"General product","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Ecommerce products"}]},{"ClrType":"Telerik.Sitefinity.DynamicTypes.Model.sf_ec_prdct_software","Name":"Software","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Ecommerce products"}]},{"ClrType":"Telerik.Sitefinity.DynamicTypes.Model.sf_ec_prdct_song","Name":"Song","Providers":[{"Name":"OpenAccessDataProvider","Title":"Default Ecommerce products"}]}]


    Please help me how to get the JSON as a response instead of WebPage.


  4. Dimitri Cools
    Dimitri Cools avatar
    80 posts
    Registered:
    30 Sep 2016
    03 Jun
    Link to this post
    Hi, 

    In order to get list of all methods that a service exposes, you can use a web browser that supports XML response, such as IE or Firefox, and open the following address of a web service:
    http://yourserver/<yourproject>/sitefinity/Services/<ServiceDirectory>/<ServiceName>.svc/help

    eg.
    IContentTypeService: GetModules
    Gets all the content types for the given provider. The results are returned in JSON format.
    (http://<host>:<port>/Sitefinity/Services/DynamicModules/ContentTypeService.svc/help/GetModules/response/example)


    Regards,
    Dimitri Cools
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 1 answered