have read that to use/intercept URLs in drupal, a module can use hook menu to do the relevant processing.
Have tried to implement it according to the needs after seeing the tutorials on Drupal. however it doe not seem to working at all. when the url is entered, it simply returns the error that the page cannot be found.
the info file for module is as follows:
name = news service
description = Module for news rest service
dependencies[] = services
files[] = news.module
core = 7.x
the .module file is as follows:
<?php
function news_service_menu()
{
$items['/get/news'] = array(
'page callback' => 'get_latest_news'
);
return $items;
}
function get_latest_news($page)
{
return "requested page is $page";
}
/* drupal recommends not to add the ending php tag*/
drupal is installed at localhost/drupal . the url am trying is : localhost/drupal/get/news/1
to sum up the requirement, am trying to make a REST service that simply return a custom content type (news article) as a JSON .
any help will be appreciated.