Tuesday, July 26, 2022
HomeWordPress DevelopmentUnable to create a Relaxation end-point

Unable to create a Relaxation end-point

I am tring to make an Ajax name in my plugin.
My front-end code tryes to name Relaxation my POST API wp-json/imp/search-cert

    var app = angular.module('app', []);
    app.controller('AppCtrl', perform ($scope,$http ){
        $scope.cerca = perform(){
                methodology: 'POST',
                url: './wp-json/imp/search-cert',
                knowledge: $scope.question
            }).then(perform (response) {
            }, perform (error, standing) {
                //$scope.show_error_message('Errore', error.knowledge.message);



I registered the API with this code

perform read_certificate_func( $knowledge ) {
    $posts = get_posts( array(
        'certId' => $knowledge['certId'],
    ) );

    if ( empty( $posts ) ) {
        return null;

    return $posts[0]->post_title;

add_action( 'rest_api_init', perform () {
    register_rest_route( 'imp',
            'strategies' => 'POST',
            'callback' => 'read_certificate_func',
    ) );
} );    

however once I invoke the API wordpress replays with 404 error
I’ve tried to place a break-point inside read_certificate_func however the perform in not processed in any respect.



Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments