REST API
REST API
Section titled “REST API”BuddyPress Giphy does not register its own REST namespace or endpoints. It extends the existing BuddyPress activity REST API by adding a bp_giphy field to every activity object.
The bp_giphy field
Section titled “The bp_giphy field”When an activity has an attached GIF, the BuddyPress activity endpoint returns a bp_giphy object alongside the standard activity fields.
Endpoint
GET /wp-json/buddypress/v1/activityGET /wp-json/buddypress/v1/activity/{id}Added field
{ "id": 42, "content": "Check this out", "bp_giphy": { "bp_activity_gif_id": "26ufdipkqArnFD0FG", "bp_activity_gif": "https://media.giphy.com/media/26ufdipkqArnFD0FG/giphy.gif" }}When the activity has no attached GIF, bp_giphy is false.
Field properties
| Property | Type | Description |
|---|---|---|
bp_activity_gif_id |
string |
The identifier assigned by the GIF provider (GIPHY or Klipy). |
bp_activity_gif |
string |
The direct image URL of the GIF. |
How the field is populated
Section titled “How the field is populated”The plugin hooks bp_rest_activity_prepare_value at priority 10. On every call to the activity REST endpoint, it reads the activity’s _bp_activity_gif_data meta record and adds it as bp_giphy to the response object.
There is no write endpoint. GIF data is saved when a member posts an activity through the BuddyPress front-end form. The REST field is read-only.
Reading GIF data without the REST API
Section titled “Reading GIF data without the REST API”When working server-side, read the activity meta directly:
$gif_data = bp_activity_get_meta( $activity_id, '_bp_activity_gif_data', true );
if ( ! empty( $gif_data['bp_activity_gif'] ) ) { $gif_url = $gif_data['bp_activity_gif']; $gif_id = $gif_data['bp_activity_gif_id'];}Authentication
Section titled “Authentication”The BuddyPress activity endpoint follows standard BuddyPress REST authentication rules. No extra capabilities are required to read bp_giphy data - it is available to any request that can read the activity object.
Related
Section titled “Related”- Filter Reference - the
bp_rest_activity_prepare_valuehook that adds this field, and thebuddypress_giphy_show_buttonfilter for controlling front-end GIF access.

