No internet connection
  1. Home
  2. Ideas

Post creation (upsert) API

By Christian Scheuer @chrscheuer2019-10-31 16:11:13.767Z

Hi @KajMagnus.

Thank you again for all your help designing & implementing the upsert API for categories.
Our users are so happy with this feature :)

I have another request in the same general area.
We're building a feedback integration inside SoundFlow, and the idea is to allow users to report errors, bugs or to ask for feedback directly from within our app.
Since we use the forum for such feedback, the idea is that we could programmatically create new threads on behalf of users.
By doing it this way, we can ensure that their feedback includes all the relevant info we need (link to upload of compressed log files, system info, and possible state of the app etc.) - while not having to use an entirely different system for that (Talkyard is extremely good for handling feedback/support forums IMO).

Would it be possible to extend the general upsert API to include creating new threads?

  • 7 replies
  1. KajMagnus @KajMagnus2019-11-01 18:23:09.896Z

    Yes, & I like this idea. Something like this?:

    POST /-/v0/upsert-simple
    

    With a JSON payload like:

    {
      pages: [
        extId: ...,
        pageType: PageType.Problem,
        categoryRef: "extid:the-category's-external-id",
        createdByRef:  "ssoid:the-single-sign-on-id-for-the-user",
        title: "Error when ...",
        bodyHtmlUnsafe: "<p>There was this problem when ... Details:</p><pre> .... system info, app state .... </pre>",
      ]
    }
    
    1. CChristian Scheuer @chrscheuer2019-11-01 18:25:47.516Z

      Yay! Yea sounds like a good start :)
      And then we'd get a response back with a URL or enough info to construct a URL (I imagine many of the same thoughts that went into the category upsert API design will also apply here).
      One great thing here is we won't have to worry about the upsertion and slug creation - this will be more simple one-off inserts 99.99% of the time.

      1. KajMagnus @KajMagnus2019-11-07 12:36:31.498Z

        Yes, what about the server returning this:

        {
          pages: [{
            id: ...,
            ...,
            urlPaths: {
              canonical: '/path/to/page',
              redirects: ['/old-path-now-redirects-to-canonical-path', '/another/old']
            }
          }]
        }
        

        Similar to the upsert-category request, which returns:

        {
          categories: [{
            id: ...,
            urlPaths: {
              activeTopics: ...,
              newTopics: ...,
              topTopics: ...,
            }
          }]
        }
        

        (Sorry for the late reply — I've been working with more complete exports & imports of one's site, ... + moved to a different place here where I am now.)

        1. CChristian Scheuer @chrscheuer2019-11-12 16:02:45.958Z

          Yes this looks great :)

          1. CChristian Scheuer @chrscheuer2019-11-13 23:42:02.144Z

            A related API (we should probably discuss this in a separate thread but thought I would first mention it here for context) would be that we'd like to be able to query for a user's most recent contributions.

            The feedback workflow we'd like for users in our app would be:

            • Send feedback
            • Choose between creating a new issue or adding to an existing one.

            Now if they choose to create a new issue, we'd need the page creation API that we're discussing here.
            If they choose to append feedback to an existing issue, we'd need a 3rd API to be able to add a post/reply to an existing page/thread.

            The reason why we would need this, is that sometimes issues will have been manually created in the forum, or we'd need more than one set of logs for the same issue.

            The option to add to an existing issue is what would require an API for us to list most recent issues that a user has contributed to or has been mentioned in. Maybe this could eventually evolve into a generic search API (I actually would probably prefer that). If it were a generic search API, then we could also use it for stuff like users searching for help with an issue, and then listing potentially matching issues. Close to what happens today inside Talkyard when creating a new post.

            1. KajMagnus @KajMagnus2019-11-14 13:50:31.332Z

              I like the idea of having such a find-topics-by-user / generic search API.

              The add-post/reply API:

              Would you want to reply to existing posts? Then you'd need the parent post's nr or extid: ... to refer to, in addition to the page's id.
              Or would you like to append posts at the bottom of the page? (Then no parent post nr needed)

              what about POST /-/v0/upsert-simple and this JSON:

              {
                posts: [{
                  extId: ...,
                  pageRef: "extid:the-page's-external-id",
                  parentNr: 123,   <— if replying to a specific post
                  createdByRef: "ssoid:the-single-sign-on-id-for-the-user",
                  text: "<p>I forgot to mention that ... </p>",
                  postType: PostType.Discussion  or  PostType.Progress
                }]
              }
              

              And a response like:

              {
                posts: [{
                  id: ...,
                  urlPath: ....,
                  nr: ...,
                  parentNr: ...,
                  postType: ...
                  text: ...,
                }]
              }
              
    2. Progress
      with doing this idea
    3. @KajMagnus marked this topic as Planned 2019-11-11 14:11:32.497Z.