Forum Discussion

MattDe's avatar
MattDe
Expert
6 years ago

v1 API /boards/id/[id]/threads endpoint pagination and inconsistent results

Hello!

We were wondering if anyone else has run into issues with the v1 API /boards/threads endpoint and omitted results, as well as broken pagination, and if there are any known workarounds without switching implementation to the v2 API or another v1 endpoint.

 

Issue 1) When querying for a larger board's threads, different page numbers are returning identical threads and posts, even when utilizing the message_viewer.topic_sort_order and message_viewer.message_sort_order parameters. Per the boards/threads/count method for our designer-discussions board, we should have 22 pages of 1000 differing threads: 

 

However, this is not confirmed in our results as page=1 and page=2 return the exact same results, but in a slightly different schema:

 

Issue 2) When querying the same v1 Board/Threads endpoint, and we aren't (intermittently) getting pages of duplicated results, we're expecting to see, per the documentation, "a list of threads in a single board. Threads include topics as well as replies, so this call provides a complete overview of activity in the specified board." Unfortunately, that is not the behavior observed in some instances, exemplified below:

Query: http://community.alteryx.com/restapi/v1/boards/id/designer-discussions/threads (&page=19&page_size=1000)

Response for thread 45945 (redacting other threads not involved in this example):

 

<thread type="thread" href="/threads/id/45945">
      <solutions>
        <solution type="message" href="/messages/id/45947">
          <root type="message" href="/messages/id/45945"/>
          <canonical_url type="string" null="true"/>
          <post_time type="date_time">2017-02-08T16:04:59+00:00</post_time>
          <parent type="message" href="/messages/id/45945"/>
          <message_status type="message_status" href="/message_statuses/id/1">
            <name type="string">Unspecified</name>
            <key type="string">unspecified</key>
          </message_status>
          <board_id type="int">17530</board_id>
          <views>
            <count type="int">10332</count>
          </views>
          <deleted type="boolean">false</deleted>
          <author type="user" href="/users/id/5127">
            <login type="string">DataBlender</login>
          </author>
          <thread type="thread" href="/threads/id/45945"/>
          <teaser type="string"></teaser>
          <board type="board" href="/boards/id/designer-discussions"/>
          <subject type="string">Re: Replacing values</subject>
          <seo_title type="string" null="true"/>
          <seo_description type="string" null="true"/>
          <message_rating type="float">0.0</message_rating>
          <last_edit_author type="user" href="/users/id/5127">
            <login type="string">DataBlender</login>
          </last_edit_author>
          <kudos>
            <count type="int">3</count>
          </kudos>
          <last_edit_time type="date_time">2017-02-08T16:07:40+00:00</last_edit_time>
          <id type="int">45947</id>
          <read_only type="boolean">false</read_only>
        </solution>
      </solutions>
      <messages>
        <topic type="message" href="/messages/id/45945">
          <root type="message" href="/messages/id/45945"/>
          <canonical_url type="string" null="true"/>
          <post_time type="date_time">2017-02-08T15:57:51+00:00</post_time>
          <parent type="message" null="true"/>
          <message_status type="message_status" href="/message_statuses/id/1">
            <name type="string">Unspecified</name>
            <key type="string">unspecified</key>
          </message_status>
          <board_id type="int">17529</board_id>
          <views>
            <count type="int">10337</count>
          </views>
          <deleted type="boolean">false</deleted>
          <author type="user" href="/users/id/10146">
            <login type="string">bdsibert</login>
          </author>
          <thread type="thread" href="/threads/id/45945"/>
          <teaser type="string"></teaser>
          <board type="board" href="/boards/id/designer-discussions"/>
          <subject type="string">Replacing values</subject>
          <labels>
            <label type="label" href="/labels/id/170">
              <id type="int">170</id>
              <text type="string">Best Practices</text>
            </label>
            <label type="label" href="/labels/id/53">
              <id type="int">53</id>
              <text type="string">Preparation</text>
            </label>
          </labels>
          <seo_title type="string" null="true"/>
          <seo_description type="string" null="true"/>
          <message_rating type="float">0.0</message_rating>
          <last_edit_author type="user" href="/users/id/196">
            <login type="string">Community_Admin</login>
          </last_edit_author>
          <kudos>
            <count type="int">0</count>
          </kudos>
          <last_edit_time type="date_time">2018-05-24T02:48:04+00:00</last_edit_time>
          <id type="int">45945</id>
          <read_only type="boolean">false</read_only>
        </topic>
        <count type="int">8</count>
        <read>
          <count type="int">0</count>
        </read>
        <linear/>
      </messages>
      <title type="string" null="true"/>
      <board type="board" href="/boards/id/designer-discussions"/>
      <id type="int">45945</id>
      <interaction_style type="string">board</interaction_style>
    </thread>

 

 

Parsing this response, the only messages returned are the original thread, 45945, and the solution, 45947. Looking at the resource in question, there are actually 7 total replies. This is confirmed using the MessageDiscussion endpoint, query: https://community.alteryx.com/restapi/v1/threads/id/45945, which shows the following (after a light parse):

 

 

Is anyone else experiencing either issue and is there any known workaround?

 

Thanks for the help!

MattDe

3 Replies

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    5 years ago

    Hi MattDe. I'm trying to track some kind of an answer down for you. I'm hoping that I can get an answer sooner than later. With the holidays, we have a few people out of the office.

  • KrisS's avatar
    KrisS
    Khoros Alumni (Retired)
    5 years ago

    Hi MattDe 

    Issue 1: The problem here is that the nested based calls aren't supported when calling /threads/. The confusion there is our documentation states it's supported, but that's an error we're working on correcting (unless it's already been corrected SuzieH ?). You'll need to remove the nested.page and nested.page_size parameters from the call if you want to get the different content returned.

     

    Issue 2: When you query threads it will return data regardless of the page (if there's enough pages of threads on the board), but the linear node ('linear' in the response) is also leveraging the page and page size parameters. This means that linear node is looking for page 2 (or higher) at 1,000 posts per page for the thread when the thread in fact does not have 1,000 messages which results in the linear node being blank.

    Normally this is handled by calling /posts/recent because that gives you every post (root messages + replies) and includes the root message ID for the purpose of mapping replies to their root message.

    DougS are there any ways to get root messages + replies outside of using posts/recent when using V1? V2 does this but in this specific example we're looking for options when using V1.