You’re using the wrong route. The first two arguments of register_rest_route()
ar the namespace, and the route. The URL to a REST API endpoint is:
(your domain) + '/wp-json/' + (namespace) + "https://wordpress.stackexchange.com/" + (route)
So the full URL to your endpoint is:
http://domain.com/wp-json/knpv-get/get-submissions
But you’re attempting to view:
http://domain.com/wp-json/knpv-get
Which won’t return the response from your callback function. However if you look closely at the result, you’ll see that it’s giving you a list of routes under the knpv-get
namespace:
{
"namespace": "knpv-get",
"routes": {
"\/knpv-get": {
"namespace": "knpv-get",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"namespace": {
"required": false,
"default": "knpv-get"
},
"context": {
"required": false,
"default": "view"
}
}
}
],
"_links": {
"self": "http:\/\/knoppysdev.com\/vendor-portal\/wp-json\/knpv-get"
}
},
"\/knpv-get\/get-submissions": {
"namespace": "knpv-get",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": [
]
}
],
"_links": {
"self": "http:\/\/knoppysdev.com\/vendor-portal\/wp-json\/knpv-get\/get-submissions"
}
}
},
"_links": {
"up": [
{
"href": "http:\/\/knoppysdev.com\/vendor-portal\/wp-json\/"
}
]
}
}