You don’t. Query args are not part of the route URL. Your endpoint URL is:
https://iotkidsiq.com/wp-json/zaindob/v1/sync_order
So needs to be registered as:
register_rest_route( 'zaindob/v1', '/sync_order', array(
'methods' => 'GET',
'callback' => 'updatetable',
) );
key
and msisdn
are arguments that are sent to your endpoint. To define these use set the args
property of the endpoint options:
register_rest_route( 'zaindob/v1', '/sync_order', array(
'methods' => 'GET',
'callback' => 'updatetable',
'args' => array(
'key' => array(
'type' => 'integer',
'required' => true,
),
'msisdn' => array(
'type' => 'integer',
'required' => true,
),
),
) );
Now your endpoint callback can accept the key
and msisdn
paramaters, and they are required for the endpoint to return a result:
function updatetable( $request ) {
$key = $request->get_param( 'key' );
$msisdn = $request->get_param( 'msisdn' );
// etc.
}