I have created a custom service where iI am passing parameters and retrieving result from another file.
So to test it iI tried on Postman and iI put urlURL with sitename/endpoint/resource and passed paramatersparameters in key value. When iI submit iI get an error as access denied user anonymous.
I have return my custom services under hook_services_resources()hook_services_resources()
function
function mymodule_services_resources() {
$api = array(
'blog' => array(
'actions' => array(
'math' => array(
'help' => 'Retrieves posted blogs',
'file' => array('type' => 'inc', 'module' => 'MYMODULE', 'name' => 'mymodule'),
'callback' => 'mymodule_blog_retrieve',
'access arguments' => array('services_access_menu'),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'var1',
'type' => 'string',
'description' => 'variable 1',
'source' => array('data' => 'var1'),
'default' => '0',
),
array(
'name' => 'var2',
'type' => 'string',
'description' => 'variable 2',
'source' => array('data' => 'var2'),
'default' => '0',
),
),
),
),
),
);
return $api;
}
); return $api; }
and inc file just takes parameters var1 and var2 and adds it and returns the sum.
Please help me finding out where i have done mistakes.