Title: Rest API Action
Last modified: August 4, 2022

---

# Rest API Action

 *  [loopforever](https://wordpress.org/support/users/loopforever/)
 * (@loopforever)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/rest-api-action/)
 * Hello,
    I have some questions about Rest API that I can’t find an answer for.
   I would be glad if you help.
 * 1-) I’m wondering if the following hook works before or after plugins are loaded
   in case of a REST API request.
    Is there any way to find out ? [do_action( ‘rest_api_init’, WP_REST_Server $wp_rest_server ) ](https://developer.wordpress.org/reference/hooks/rest_api_init/)
 * 2-) Is there a hook that works after the operation is done with the REST AP I?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/rest-api-action/#post-15889100)
 * WP has a documentation for Plugins:
    [Plugin Handbook](https://developer.wordpress.org/plugins/)
   [https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/](https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/)
   [https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/rest-api-action/#post-15892776)
 * Plugins load quite early, before requests are parsed, so I’m guessing rest_api_init
   is later. You can verify by error logging from both your plugin file and from
   the action’s callback.
 * ‘rest_pre_echo_response’ filter fires just before the API’s JSON response is 
   echoed out. Hence the API is not quite done yet, but very close to being done.
   There could be a later hook, IDK.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Rest API Action’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/rest-api-action/#post-15892776)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
