No internet connection
  1. Home
  2. Documentation
  3. API

How to Like and Subscribe to Pages via the API

By KajMagnus @KajMagnus2021-09-15 15:04:27.458Z2021-09-15 15:27:09.043Z

You can let your users Like vote a Talkyard page, and subscribe to it via the API.

But first, read about the Talkyard API authentication, including about how to enable the API.

Now. Let your backend server, with an API secret, do as follows:

Send a POST request to /-/v0/do with this payload:

POST http://your-talkyard-site/-/v0/do  {
  doActions: [{
    asWho:  'USER_REF',
    doWhat: 'SetVote',
    doHow: {
      whatPage: 'PAGE_REF',
      whatVote: 'Like',
      howMany: 1   // 0 to delete the vote
  }, {
    asWho: 'USER_REF',
    doWhat: 'SetNotfLevel',
    doHow: {
      whatPage: 'PAGE_REF'
      whatLevel: 'NewPosts'   // 'Normal' to undo


  • USER_REF is e.g: username:someones_talkyard_username or, if you use Single Sign-On: ssoid:user-id-in-your-database
  • PAGE_REF is e.g.: pagepath:/URL-path/to/the/page/in/the/talkyard/forum e.g. pagepath:/-1234/page-slug; or pageid:1234.

Currently each action is done in its own database transaction, and the server aborts the current action and any subsequent actions, on any error. — Later, there'll be a way to you to control transactions yourself, maybe a singleTransaction: true/false JSON field.


Here're Typescript types for the Do API JSON request body:

Here's an end-to-end test where you can see source code calling the Do API:
At the bottom of that file, there's a function makeLikeAndSubscribeActions() that constructs JSON for Like voting and subscribing.

  • 0 replies