Wappler Community as API - WWC #2


I quit.


Lol. Why. Haha is the API thing driving you nuts.


No, yours is pretty clever, and I don’t have the time right now to figure out how to do all of this. The holidays is a bad time around here. Too much work! lol


Small update from my previous version, 1 less API call and found a better API call to get all docs categories without the need of the where formatter.

<!doctype html>
    <meta charset="UTF-8">
    <title>API Sample</title>
    <script type="text/javascript" src="dmxAppConnect/dmxAppConnect.js"></script>
    <script type="text/javascript" src="dmxAppConnect/dmxFormatter/dmxFormatter.js"></script>
      body {
        font-family: verdana;
        font-size: 12px;
        margin: 0;
        padding: 0;
      ul {
        margin: 0;
        padding: 0;
        padding-left: 1em;
      li {
        list-style: none;
  <body is="dmx-app" id="app">
    <dmx-api-datasource id="api_categories" is="dmx-fetch" url="https://community.wappler.io/categories.json" dmx-param:parent_category_id="28"></dmx-api-datasource>
    <dmx-api-datasource id="api_topic" is="dmx-fetch" dmx-bind:url="'https://community.wappler.io/t/' + showTopic.value + '/posts.json'"></dmx-api-datasource>
    <dmx-value id="showTopic" value="2790"></dmx-value>
    <div style="display: flex">
      <div style="flex: 1; padding: 10px; border-right: 1px solid #666;">
          <li dmx-repeat="api_categories.data.category_list.categories">
            <dmx-api-datasource id="api_topics" is="dmx-fetch" dmx-bind:url="'https://community.wappler.io/c/docs/' + id + '.json'"></dmx-api-datasource>

              <li dmx-repeat="api_topics.data.topic_list.topics"><a href="javascript:void(0)" dmx-on:click="showTopic.setValue(id)">{{title}}</a></li>
      <div style="flex: 2; padding: 10px;" dmx-html="api_topic.data.post_stream.posts[0].cooked">


Much much better @patrick, i did not realise you could pass the parameter instead of the where clause, much cleaner solution. I scoured those API docs on discourse and never found any mention of something like that anywhere, so I have no clue where the heck you found mention of that.


Docs for the Discourse API are not that good, you can find them at https://docs.discourse.org/, but it is not complete and doesn’t mention how to get the sub categories. I did find the parameter by inspecting the calls made by the forum, it uses ember for the rendering and uses the same API calls using Ajax.


Thanks Patrick, the other strange thing I noted when working with the API was that when I did an API fetch and it pulled in hundreds of fields and i compared those against what the discourse docs were saying should be available, there were some missing, that when i manually typed them into Wappler did have data inside. I found it strange that they were unavailable in the initial fetch though. I assume that is something wrong in the discourse stuff though?


Sorry, last notable thing is that although the API in Wappler can take a dynamic URL using the dmx-bind:url it is not really an openly available thing to do, hope that makes sense.

unassigned patrick #30

closed #31