Skip to main content

How to Create and Fetch a Custom Widget?

Introduction​

This guide walks you through creating a custom widget that suits a specific use case.

Prerequisites​

Before you begin, ensure the following:

  • Familiarity with Postman or a similar API testing tool.

Steps​

Step 1: Initiate a User Session​

Authenticated API calls to the LikeMinds backend require an authorization token, which you can generate by following the Getting Started Guide. Ensure you log in with the Community Manager's credentials.

Step 2: Create a Custom Widget​

To create a custom widget, use the following POST request. Replace {cm_access_token}, PARENT_ENTITY_ID, and PARENT_ENTITY_TYPE with your specific values:

curl --location 'https://auth.likeminds.community/widget' \
--header 'Content-Type: application/json' \
--header 'Authorization: {cm_access_token}' \
--data '{
"parent_entity_id": "PARENT_ENTITY_ID",
"parent_entity_type": "PARENT_ENTITY_TYPE",
"metadata": {
"post_type": "post_type_1",
"widget_type": "post_type"
}
}'

Step 3: Retrieve a Custom Widget​

To retrieve a custom widget, use the following POST request. Replace {your_search_query} with your specific query:

curl --location 'https://auth.likeminds.community/widget?search_key=%22metadata.widget_type%22&search_value=%22{your_search_query}%22' \
--header 'Authorization: {cm_access_token}'