No internet connection
  1. Home
  2. Ideas

Create new forum via API

By @fas
    2021-12-20 14:18:21.496Z

    Hi Kaj,
    Do you still have plans to extend the API to be able to create new forums programmatically. It's a feature I really need to allow easy extension of my training platform. Thanks for checking.

    • 5 replies
    1. In reply tofas:

      Yes. How would you want to tell Talkyard who the owner of the new site will be? Should that be part of the API request, e.g. the new site owner's email address? (Or can you think of other ways to do this?)

      1. F@fas
          2021-12-21 05:16:00.178Z

          Hello Kaj,

          Yes, this should all be part of the API please.


          1. Hi Franz, started with this just recently. Happy new year in advance :- )

            1. F@fas
                2022-01-01 10:08:05.677Z

                Hello Kaj. Thats a wonderful gift for the new year, thank you. And my best wishes for the new year to you too. And prosperity and success for your business. Franz

          2. In reply tofas:
            KajMagnus @KajMagnus2022-01-20 15:07:42.890Z2022-01-20 15:20:21.161Z

            Hi Franz, this has now been implemented
            (and is available in the Ty .net SaaS-hosted sites, and in the self hosted release channel tomorrow Friday I would think).

            Here's how it works:

            curl -X POST http://localhost/-/v0/create-site  \
                -H 'Content-Type: application/json'  
                -H 'Authorization: Basic Y3JlY.........Y3JldA=='  \
                -d '{
              //  "testSiteOkDelete":true,
              "embeddingSiteAddress": "",
              "organizationName":"E2E Test Create Site Via Api",
            // The response would be:
            // { "newSite": { "id": 1234, "origin": "" } }

            That'll create a blog comments site with the local hostname:
            comments-site-12345, the full hostname would be:

            if in /opt/talkyard/conf/play-framework.conf you have configured:


            And the Authorization header value should be: "Basic BASE64_USER_PWD"
            where BASE64_USER_PWD is this: "createsite:CREATE_SITE_API_SECRET" base64 encoded (that is, the Basic Auth username must be "createsite").

            A blog with address would be allowed to embed the comments.

            Currently a site owner email address is required: When visiting the site for the first time, the site owner needs to click the Did you forget your password? link in the login dialog, and can then type his/her email — and if it's the correct address (i.e. the ownerEmailAddr) s/he will get a password reset email.


            If you want a discussion forum, instead of blog comments — then,
            replace createEmbeddedComments: true
            with: createForum: true,

            and remove embeddingSiteAddress.


            End-to-end test, for creating an embedded comments site:

            For creating a discussion forum:

            The function that does the /-/v0/create-site API request:


            It'd be interesting to hear about things you'd like to work differently :- ) — I'm guessing you aren't happy with precisely all details.

            Maybe you'd like the site owner to get a magic URL with a one-time-login secret, so s/he didn't need to click Forgot Password, for example.

            1. Progress
              with doing this idea
            2. @KajMagnus marked this topic as Planned 2021-12-21 04:13:41.971Z.
            3. @KajMagnus marked this topic as Started 2021-12-31 12:14:18.818Z.