sagar290/alpine-rest-api

This a restapi plugin for wordpress.

dev-master 2022-01-18 06:35 UTC

This package is auto-updated.

Last update: 2024-09-18 13:06:40 UTC


README

Wordpress rest api. Easy to make and customise

Supported method

    'GET',
    'POST',
    'PUT',
    'PATTCH',
    'DELETE',
    'PURGE',
    'UNLINK',
    'HEAD',

Method parameter

Route::get('namespace', 'endpoint', 'callback',  'permission_callback');

Example

use Sagar290\RestApi\AlpineRestApi as Route 

function method($request) {
    $name  =  $request['name'];
    wp_send_json_success($name, 200);
}

Route::post('namespace/v1', '/addProduct', "method");

You can access this by

Body

{
    "name": "sagar"
}
POST https://yourdomin.com/wp-json/namespace/v1/addProduct

Response

{

    "success":  true,
    "data":  "Sagar"

}