Skip to main content

Overview

This document outlines the APIs and flows to be employed for the migration of client feed data to the LikeMinds platform using APIs.

Operating Procedure

The steps involved in the migration process are listed below, beginning with user data creation on the LikeMinds platform and subsequently creating feed data from the client data reference using various APIs.

Authentication

Retrieve the project LikeMinds API key from the dashboard, as this will be required for SDK Initiate. It uniquely identifies a project on the LikeMinds platform.

User Data Creation

  1. For each user on the client platform, hit the initiate API SDK Initiate to create a new user on the LikeMinds platform.
  2. Save the response to create a mapping from Customer ID ↔︎ LikeMinds access_token & refresh_token.
  3. Keep the mapping for the following keys for each client-side user (these will be required later):
- `access_token` - access token for user authentication
- `refresh_token` - refresh token to generate a new access token for the user when the existing one expires
- `user_unique_id` - corresponding LikeMinds platform unique ID of the user

Refresh Token Strategy

  1. Use the user's access_token generated in the previous step as the Bearer Token.
  2. If LM APIs return statusCode: 401, use the user's refresh_token and hit the refresh token API to generate a new access_token.

Feed Data Creation

  • Post

    Note: Please do replace the placeholders with actual values before executing the cURL commands.

    • For each post on the client platform, transform the data into the LikeMinds schema and hit the create post API.
      curl --request POST \
      --url https://auth.likeminds.community/feed/post \
      --header 'Accept: application/json' \
      --header 'Authorization: <auth_token>' \
      --header 'Content-Type: application/json' \
      --header 'x-platform-code: <platform_code>' \
      --header 'x-version-code: <version_code>' \
      --data '{
      "text": "string", //Question description
      "heading": "string", //Question
      "created_at": 1711607084000 //Epoch Value in Milliseconds
      "topic_ids":[<topic_id>"] //Topic IDs
      "attachments": [
      {
      "attachment_type": 1,
      "attachment_meta": {
      "url": "string", //Attachment URL
      "format": "string",
      "size": 0,
      "duration": 0,
      "page_count": 0,
      "og_tags": {
      "title": "string",
      "image": "string",
      "description": "string",
      "url": "string"
      }
      }
      }
      ]
      }'
    • The user creating the post (i.e., the request initiator) is identified using the Bearer Token authorization header.
    • Use the Refresh Token Strategy (as mentioned above).
    • Keep the mapping for the following key for each post created:
      • _id - corresponding post ID on the LikeMinds platform (this will be required later)
  • Post Like
    • For each post like, hit the post like API.
    • The user creating the post like (i.e., the request initiator) is identified using the Bearer Token authorization header. Use the Refresh Token Strategy if authentication fails.
    • Use the post's _id generated in the post creation step to identify the post.
  • Post Comment
    • For each post comment, hit the post comment API.
    • The user creating the post comment (i.e., the request initiator) is identified using the Bearer Token authorization header.
    • Use the Refresh Token Strategy (as mentioned above).
    • Use the post's _id generated in the post creation step to identify the post.
    • Keep the mapping for the following key for each post comment created:
      • _id - comment ID on the post on the LikeMinds platform (this will be required later)
  • Comment Like
    • For each comment like, hit the comment like API.
    • The user creating the comment like (i.e., the request initiator) is identified using the Bearer Token authorization header. Use the Refresh Token Strategy if authentication fails.
    • Use the comment's _id generated in the comment creation step to identify the comment.
  • Topic
    • For each Topic creation, you need to hit the POST /feed/topic API.
    • NOTE: This is an Admin API, and you'll be required to log in using CM.
      curl --location 'https://auth.likeminds.community/feed/topic' \
      --header 'Authorization: <auth_token>' \
      --data '{
      "topics": [
      {
      "name": "USA", // Topic Name
      "parent_id": "64c9419bb4629de3c80f640b", //Parent ID for Topic
      "priority": 9, //Set the ordering
      "metadata": {
      pgc:{
      post_links:{}
      },
      "description": "This description is for topic North Pole",
      "cover_image": "https://a.cdn-hotels.com/gdcs/production121/d772/6b5a9a4c-fd06-4bcf-b2f0-d979e3704cf9.jpg",
      "icon": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_United_Arab_Emirates.svg/800px-Flag_of_the_United_Arab_Emirates.svg.png"
      },
      "is_searchable": "true"
      }
      ]
      }'
    • For creating L0 topics, send the following parameters in the request body:
      • name
      • priority
      • is_searchable
    • For creating L1 topics, send the following parameters in the request body:
      • name
      • priority
      • metadata
      • is_searchable