We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48142
    • 2 Posts
    Hi Everyone,

    I am completely new to ModX although I have been working with various CMS's for some time - quite interested to learn about a new one. My client has a web site built in ModX Revo 2.x and we want to create a mobile app that uses some of that content. I see that the ModX interface is built with Sencha and as such it might have a JSON interface of some sort that can be exposed publicly. Essentially I'm thinking of building an API that my app can use unless there is one already available - in which case could someone point me at the correct docs ? I am building the app with Sencha Touch so I'm hoping the fact that ModX is Sencha based will make life a bit easier. If anyone has any other suggestions I'd appreciate it.

    I've had a look at SimplxRPC but this seems quite old and it doesn't appear in the 2.2 package manager. I'm guessing this may not be best practice any more.

    If anyone has any advice I'd much appreciate it,

    Thanks,
    Tim
      • 38878
      • 255 Posts
      Welcome to MOdX.

      Based on what you asked and considering the content already exists, I assume you just want to expose the existing resources to mobile clients, correct? There is no OOTB JSON interface/service you can consume that I am aware of. However, you can easily (relatively that is) provide one using the XPDO API and custom snippets using the http://rtfm.modx.com/xpdo/2.x/class-reference/xpdo library. Probably the following two methods would be enough:
      This should get you started. There also a similar thread at http://forums.modx.com/forums/thread/15393/modx-revo-getresources-format-json about using getResources to output JSON if you don't want to roll your own custom snippets. Less PHP development, and would probably give you a better idea how ModX works before you start writing custom snippets.

      Which way you go really depends on your experience with PHP and development in general. Either way will probably get you there. Im sure there are other ways.

      For more on snippets, there's an excellent tutorial from BobRay at http://bobsguides.com/modx-snippet-faq.html

      Good luck and ask away if you have more questions.
        • 48142
        • 2 Posts
        Hey Harvey

        Thanks for taking the time to respond.

        You're absolutely right, I'm just looking to expose the existing resources (pages) but would like to download the content in JSON format, so it's easy to consume on the mobile app.

        I will review the links and see if I can figure out how to implement that.

        Kind regards,

        Tim