Guest User

Untitled

a guest
Dec 6th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. 'create-product' => array(
  2. 'operations' => array(
  3. 'create' => array(
  4. 'help' => t('Add Product'),
  5. 'file' => array(
  6. 'type' => 'endpoints.inc',
  7. 'module' => 'custommodule',
  8. 'name' => 'custommodule',
  9. ),
  10. 'callback' => 'custommodule_create_product',
  11. 'args' => array(
  12. array(
  13. 'name' => 'appID',
  14. 'type' => 'int',
  15. 'description' => t("App ID"),
  16. 'source' => array('data' => 'appID'),
  17. 'optional' => FALSE
  18. ),
  19. ...
  20.  
  21. // ...
  22. 'access callback' => '_example_resource_access',
  23. 'access callback file' => array(
  24. 'type' => 'inc',
  25. 'module' => 'example',
  26. 'name' => 'example.resource-access',
  27. ),
  28. 'access arguments' => array('foo bar'),
  29. 'access arguments append' => TRUE,
  30. // ...
  31.  
  32. function _example_resource_access($op, $args = array()) {
  33. if ($op == 'foo bar' && !is_numeric($args[0])) {
  34. return services_error(t('That is not an integer.'), 406);
  35. }
  36. return TRUE;
  37. }
Add Comment
Please, Sign In to add comment