Skip to:
Content
Pages
Categories
Search
Top
Bottom

Solved – How to Create Custom Endpoint Route?


  • evohans
    Participant

    @evohans

    re: https://developer.buddypress.org/bp-rest-api/extending-the-bp-rest-api/

    I’m a little stuck on the documentation, how would I go about creating a new route for say…. adding reactions to an activity field?

    I started playing around with building it but became confused as to how to actually execute a reaction on an activity

    bp_rest_register_field(
            'activity',      
            'reactions', 
                    array(
                        'get_callback'    => 'get_additional_field',   
                        'update_callback' => 'update_additional_field', 
                        'schema'          => array(                               
                            'description' => 'Reactions on Activity',
                            'enum'          => array('HAPPY', 'LOVES', 'DISLIKES','FUNNY', 'WOW', 'ANGRY', 'SAD'),
                            'type'        => 'string',
                            'context'     => array( 'view', 'edit' ),
                        ),
                      )
                  );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar