Reading custom modules using REST API - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Reading custom modules using REST API

  • Reading custom modules using REST API
  • 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
  • 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
     
  • 4f5b541e-37c1-6deb-a958-ff0000446526_webpageresponse.png

    Hi Dimitri,

    Thank you. I am trying to read the all dynamic modules which are available in Sitefinity using angular JS.
    I was using localhost:60876/.../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.


  • 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:
    yourserver/.../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