Specifying HTTP method in action methods

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by fulat2k on July 1, 2013 at 2:58pm

Hi folks,

I've defined an action method which is exposed as a web service. However, all actions are called via the HTTP POST method.

Is there a way to explicitly state which HTTP method a particular action supports?

As an example, here's what I have defined:

'validate' => array(
'help' => 'Validates bonus code',
'callback' => 'gs_bonus_validate_code',
'access arguments' => array('access content'),
'args' => array(
array(
'name' => 'code',
'type' => 'string',
'description' => 'Bonus code to be validated',
'optional' => FALSE,
'source' => array('path' => 1),
),
),

Here's what I'd like to be able to do:

'validate' => array(
'help' => 'Validates bonus code',
'http method' => 'GET',
'callback' => 'gs_bonus_validate_code',
'access arguments' => array('access content'),
'args' => array(
array(
'name' => 'code',
'type' => 'string',
'description' => 'Bonus code to be validated',
'optional' => FALSE,
'source' => array('path' => 1),
),
),

Thanks!

Categories:

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /