Posts

Showing posts from January, 2025

Android Monkey

  UI/ Application Exerciser Monkey The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner. Overview The Monkey is a command-line tool that you can run on any emulator instance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing. The Monkey includes a number of options, but they break down into four primary categories: Basic configuration options, such as setting the number of events to attempt. Operational constraints, such as restricting the test to a single package. Event types and frequencies. Debugging options. When the Mon...

Like comment and replies

  Here is the full code that registers the custom APIs for replies, likes, comments, and retrieving comment details with associated user data in WordPress. I've also included the expected payloads for the APIs. Full Code with APIs and Payloads // Register the custom REST API route for replies function register_custom_replies_endpoint() { register_rest_route( 'custom/v1', '/comment/reply', array( 'methods' => 'POST', 'callback' => 'handle_reply_to_comment', 'permission_callback' => function() { return current_user_can( 'edit_posts' ); } )); } add_action( 'rest_api_init', 'register_custom_replies_endpoint' ); // Handle Reply to Comment function handle_reply_to_comment( $data ) { $comment_id = isset( $data['comment_id'] ) ? intval( $data['comment_id'] ) : 0; $content = isset( $data['content'] ) ? sanitize_text_f...

Likes and comments apis

  Here are the extracted API endpoints and their corresponding payloads: 1. BuddyPress Activity Likes (POST & DELETE) Endpoint : /buddypress/v1/activity/(?P<activity_id>\d+)/likes Methods : POST : Like an activity DELETE : Unlike an activity Payload : No request payload. Just the activity_id in the URL. Response: Success message or error message. 2. Get Activity by ID Endpoint : /buddypress/v1/activity/id/(?P<id>\d+) Methods : GET : Retrieve activity details by ID. Payload : No request payload. Just the id in the URL. Response: Activity data. 3. Custom Like Post Endpoint : /custom/v1/like Methods : POST : Like a post Payload : { "post_id": "integer" // The ID of the post } Response: Success or error message. 4. Custom Unlike Post Endpoint : /custom/v1/unlike Methods : POST : Unlike a post Payload : { "post_id": "integer" // The ID of the post } Response: Success or error message. 5. Get Total Likes and...

Status Like & Comment

127.0.0.1/wordpress/wp-json/buddypress/v1/activity       { "component" : "activity" , // Component indicating the type of activity (activity stream). "type" : "activity_update" , // Type of activity (status update). "content" : "This is a Facebook-like status update 2!" , // Content of the status. "user_id" : 2 , // User ID of the person posting the status update (dynamic user ID). "primary_link" : "http://127.0.0.1/wordpress/members/akkas/" , // Optional: URL to the user's profile. "avatar_urls" : { // Avatar URLs (Gravatar or custom avatar). "full" : "https://www.gravatar.com/avatar/a5db4e946574f4841faf2dad0d99c635?s=150&d=mm" , // Full avatar image. "thumb" : "https://www.gravatar.com/avatar/a5db4e946574f4841faf2dad0d99c635?s=50&d=mm" // Thumbnail avatar image. }, "xprofile" : ...

Profile buddy press

  BuddyPress provides an API to manage user profiles, allowing you to retrieve and update user profile data. Below is a breakdown of the Profile API in BuddyPress, which is typically used to manage user profile fields, view user profile information, and update profile data. 1. Get User Profile Data This endpoint retrieves the profile information of a specific user, including their custom profile fields, if they exist. Endpoint : http://127.0.0.1/wordpress/wp-json/buddypress/v1/members/{user_id}/profile Request Parameters : {user_id} : The ID of the user whose profile you want to retrieve. Example Request (Get User Profile): curl -X GET "http://127.0.0.1/wordpress/wp-json/buddypress/v1/members/2/profile" \ -H "Authorization: Bearer YOUR_TOKEN" Example Response : { "id": 2, "username": "user2", "name": "User Two", "avatar_urls": { "full": "http://127.0.0.1/wordpress/wp-c...

buddypress groups

  The BuddyPress REST API includes endpoints for managing groups , which are a central feature of BuddyPress, allowing users to create and manage groups, as well as interact with group content. Below are the common Group API endpoints provided by BuddyPress and examples of how to use them. 1. Get All Groups This endpoint allows you to retrieve a list of all the groups on the BuddyPress site. Endpoint : http://127.0.0.1/wordpress/wp-json/buddypress/v1/groups Request Parameters : per_page : Number of groups to return per page (default: 10). page : The page number for pagination. search : Search groups by name. Example Request : curl -X GET "http://127.0.0.1/wordpress/wp-json/buddypress/v1/groups?per_page=5&page=1" \ -H "Authorization: Bearer YOUR_TOKEN" Example Response : { "groups": [ { "id": 1, "name": "Group One", "slug": "group-one", "description": ...

public and private message

  In BuddyPress, the messages API typically supports private messaging between users. While there isn’t a dedicated "public message" feature in BuddyPress, messages can be exchanged privately between users, and you can handle both private and public messaging with some adjustments. 1. Private Messaging (BuddyPress) Private messages are direct messages between two users, and the BuddyPress API handles them through the messages system. Here’s how you interact with private messages: Get Messages (Inbox or Sent) You can get private messages from a user’s inbox or sent box. Endpoint : http://127.0.0.1/wordpress/wp-json/buddypress/v1/messages Request Parameters : box : inbox , sentbox (defaults to inbox ). per_page : Number of messages per page. page : Page number for pagination. Example Request (Get inbox messages): curl -X GET "http://127.0.0.1/wordpress/wp-json/buddypress/v1/messages?box=inbox&per_page=5&page=1" \ -H "Authorization: Bearer YO...

Mentions in Buddypress

  BuddyPress provides functionality for mentions, but as of now, the BuddyPress REST API does not have a dedicated endpoint for mentions specifically. However, mentions are typically integrated into the activity streams and are used when users mention other users in their activity posts (i.e., when typing @username in the activity content). If you want to interact with mentions in BuddyPress, you need to handle them through activity content or by filtering activity stream data. Here's how you can interact with the activity stream and potentially capture mentions: 1. Create an Activity with Mentions When you create an activity, you can include mentions by using @username in the activity content. This triggers BuddyPress to notify the mentioned user. Endpoint : http://127.0.0.1/wordpress/wp-json/buddypress/v1/activity Request Payload Example (Creating Activity with Mentions): { "content": "Hey @username1, check this out!", "user_id": 1, ...

Activity api of buddypress

  Here are the details for the BuddyPress Activity API , including endpoints to retrieve and manage activities. 1. Get Activity Stream Endpoint : http://127.0.0.1/wordpress/wp-json/buddypress/v1/activity Request Parameters : Parameter Type Required Description user_id Integer No The ID of the user for whom to get activity. per_page Integer No Number of activities per page (default is 20). page Integer No Page number for pagination. type String No Filter activities by type (e.g., activity_update ). Example Request (Get Activity for a Specific User) : curl -X GET "http://127.0.0.1/wordpress/wp-json/buddypress/v1/activity?user_id=1&per_page=5&page=1" \ -H "Authorization: Bearer YOUR_TOKEN" Example Response : { "activities": [ { "id": 1, "user_id": 1, "content": "User 1 posted an activity.", "date": "2025-01-03T10:30:00...