We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18809
    • 109 Posts
    Thank you sir its working as it should. Now How to get Tags with Links ?
    and How to get featured images ? And how can I filter posts, date, introtext etc ?
    Like this - http://irresistiblemt.in/appwp/wp-json/wp/v2/posts?fields=id,title

    Check here Modx REST Wroking -
    http://irresistiblemt.in/mymodx/rest/box/

    What if I want only a special resource like suppose im fetching data from my About us page and its id is 34. So how can I get the resource of only id 34?
    http://irresistiblemt.in/mymodx/rest/box?filter='34,content,createdon' ? huh???????

    I want like this
    http://irresistiblemt.in/appwp/wp-json/wp/v2/posts?filter[posts_per_page]=10

    And tagger tags, post thumbs etc. and data from specific resource...
    How sir ?

    Thanks smiley <3
      My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
      • 18809
      • 109 Posts
      I am waiting for replies sir smiley
      Help me please.
        My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
        • 3749
        • 24,544 Posts
        I'm afraid I don't know enough about tagger to be any help.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 18809
          • 109 Posts
          Ok then what about filters? Wgat if i want only id, content and date?? And how to get featured images???
            My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
            • 18809
            • 109 Posts
            So there is no one in this community who can help me ?
            This community is so weak .. I am started to disliking Modx ..
            Wordpress' community and response is so strong that there is no doubt why is on top.
            I feel really bad now.. and sad for Modx users sad
              My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
            • Whatever works for you. If you can get people in the WordPress community to build complex integrated apps for you for free, then certainly WordPress is your solution.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 18809
                • 109 Posts
                Quote from: sottwell at Oct 19, 2017, 04:12 PM
                Whatever works for you. If you can get people in the WordPress community to build complex integrated apps for you for free, then certainly WordPress is your solution.
                In this case, it is not that complex to do but I know im missing something and thats what im asking for help.
                And in wordpress' case, there is already REST Api plugins provided and VERY WELL DOCUMENTED by Wordpress team. So no need to ask people to build complex apps for free.
                  My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
                • $_GET parameter values (at least in the get method) could be retrieved with $this->getProperty('key'). In post/put only $_POST values could be retrieved with that method.

                  '?filter[posts_per_page]=10' could be retrieved with the following code and set as limit in the get() method

                  $filters = $this->getProperty('filters');
                  $this->$limit = $this->modx->getOption('posts_per_page', $filters, $this->limit);
                  


                  Everything else could be done with the modx/xpdo methods, i.e. getCollection/getIterator, getObject etc. A few things are prepared in the modRestController class and could be extended in your own classes inherited from that class. So please read the class code of modRestController/modRestService to get inspired. Use a remote debugger on modRestController and your inherited class, to see how it works live.

                  A few tipps:

                  • TVs could be retrieved with $this->object->getTVValue('tvname'), if $this->object is an instance of modResource. This could be set with $classKey='modResource' in the variable declaration part of the class code or in the initialize method.
                  • You could use $this->modx->runSnippet('snippetname', array('propertyname' => 'value') in your code. The result of the taggerGetResourcesWhere snippet could be used to write an the $c->where() query in the prepareListQueryBeforeCount method.
                  • $c->prepare();die($c->toSQL()); shows the current database query in the end of the prepareListQueryBeforeCount/prepareListQueryAfterCount methods.
                  • PhpStorm has a nice RESTful Webservice Tester with a possibility to remote debug your code - if setup properly.

                  We are all volunteers here and do that for free, so please don't expect a fast answer on every question. And please be kind and post back your result, if you are finished. Maybe you could write a tutorial on this in the docs or in your blog.
                    • 18809
                    • 109 Posts
                    @Jako sir than kyou very much for help. I will try this. And I dont expect fast response for any of my topics and or question, but I expect at least a response so I can figure out things. I dont want anyone to reply me fast but at least reply. smiley
                      My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
                      • 18809
                      • 109 Posts
                      Quote from: Jako at Oct 19, 2017, 08:55 PM
                      $_GET parameter values (at least in the get method) could be retrieved with $this->getProperty('key'). In post/put only $_POST values could be retrieved with that method.

                      '?filter[posts_per_page]=10' could be retrieved with the following code and set as limit in the get() method

                      $filters = $this->getProperty('filters');
                      $this->$limit = $this->modx->getOption('posts_per_page', $filters, $this->limit);
                      


                      Everything else could be done with the modx/xpdo methods, i.e. getCollection/getIterator, getObject etc. A few things are prepared in the modRestController class and could be extended in your own classes inherited from that class. So please read the class code of modRestController/modRestService to get inspired. Use a remote debugger on modRestController and your inherited class, to see how it works live.

                      A few tipps:

                      • TVs could be retrieved with $this->object->getTVValue('tvname'), if $this->object is an instance of modResource. This could be set with $classKey='modResource' in the variable declaration part of the class code or in the initialize method.
                      • You could use $this->modx->runSnippet('snippetname', array('propertyname' => 'value') in your code. The result of the taggerGetResourcesWhere snippet could be used to write an the $c->where() query in the prepareListQueryBeforeCount method.
                      • $c->prepare();die($c->toSQL()); shows the current database query in the end of the prepareListQueryBeforeCount/prepareListQueryAfterCount methods.
                      • PhpStorm has a nice RESTful Webservice Tester with a possibility to remote debug your code - if setup properly.

                      We are all volunteers here and do that for free, so please don't expect a fast answer on every question. And please be kind and post back your result, if you are finished. Maybe you could write a tutorial on this in the docs or in your blog.


                      Can you make a working example for me and all the members who are trying to use REST APi ?
                      Working example for a BlogIt Extra which is using Collections, PdoTools, Tagger etc extras ?
                      A good working example would be great for all of us if you or anyone know how this works ?
                      I think a basic working example should be on documentation. smiley
                        My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.