Any time you want to create a new path that links to custom functionality, you’ll want to reach for .
Drupal does a great job of handling url aliases to nodes and other entities (taxonomy, users, etc), but the admin forms don’t allow you to trigger custom PHP code at an arbitrary path.
"access callback" will be called when rendering links to the path to determine if the user has access and the link should be shown, so the query parameter will not be available on the page that contains the link.
You should always keep arguments passed to menu callbacks as an array, anyway.
Enable the module, and go to /hello on your website. In the example below, this means the 0 will be turned into 'hello', as that's the first, and only, part of the URL. Often a URL argument will be the ID-number of something, such as an entity.
There are several contributed options to accepting JSON POST, but you may find a custom option best fits your needs.
I've got this menu hook below by which I'm sending two parameters to the function.
But in the function I am only receiving the first parameter.
One disadvantage with using Services is the lack of backwards compatibility between versions; with a history of breaking upgrade paths between major point releases. The RESTful Web Services module does not currently have other supporting modules, but should be very forward compatible with Drupal with its ground up entity support.
A Web Services initiative to provide a core RESTful solution has been under development for Drupal 8.