Hook menu url giving access denied for post method but working for get method I defined a custom url using hook_menu and a custom delivery callback that returns json output. 

I wanted the url to work on the post method but it is giving access denied for requests done using the post method but it is working without issues for get method. 

How do I debug and see why post methods are being denied access?

/**
 * @file
 * Implements menu functions for returning json output.
 */

/**
 * Implements hook_menu().
 */
function mymodule_menu() {
  $items['api/json/select/programs'] = array(
    'access callback' =&gt; TRUE,
    'access arguments' =&gt; array('access content'), 
    'page callback' =&gt; 'mymodule_api_return_aid_program',
    'delivery callback' =&gt; 'mymodule_api_json_output_wrapper',
    'type' =&gt; MENU_CALLBACK,
    'access callback' =&gt; TRUE,
  );
 return $items;
}

/**
 * Custom page callback function - Retuns the uid of the user on passing
 * valid username and passowrd returns error otherwise
 *
 * @return $uid
 *   Uid of the user on success, NULL if other wise
 *
 * @return $status
 *   success of the user on success, failure if otherwise
 */
function mymodule_api_return_aid_program() {
  try {

    // Fetching the primary parameters 
    //product code
    $product = $_POST['product'];
    //country code
    $country = $_POST['country'];
    // language code
    $language = $_POST['language'];


    // age
    //citizenship
    // veteran_status
    $values = _find_product_specific_to_country($product, $country);


    return array('message' =&gt; array('nodes' =&gt; $values));
  }
  catch(Exception$e) {
    return array('status' =&gt; FALSE, 'message' =&gt; $e);
    watchdog('Aid API ERROR', $e);
  }
}

/**
 * Custom delivery callback function
 *
 * @param $var
 *   The argument to the delivery callback function
 *
 * @return array
 *   Contains json encoded format of $var on succes,
 */
function mymodule_api_json_output_wrapper($var) {
  // If the access callback is FALSE
  // it will pass MENU ACCESS DENIED to the
  // delivery callback function
    //return drupal_json_output($var);
  if ($var == MENU_ACCESS_DENIED) {

    return drupal_json_output(array('status' =&gt; FALSE, 'message' =&gt; 'Invalid Token. Access Denied'));
  }
  else {
    return drupal_json_output($var);
  }
}
e
your code works for me:

Try to move watchdog before return if there is any exception, will log into your report log.
Change your function to like this:

function mymodule_api_return_aid_program() {
  try {
    // Fetching the primary parameters
    //product code
    $product = $_POST['product'];
    //country code
    $country = $_POST['country'];
    // language code
    $language = $_POST['language'];
    // age
    //citizenship
    // veteran_status
    $values = _find_product_specific_to_country($product, $country);
    return array('message' =&gt; array('nodes' =&gt; $values));
  } catch (Exception $e) {
    watchdog('mymodule', 'Aid API ERROR ' . $e-&gt;getMessage(), array(), WATCHDOG_NOTICE, NULL);
    return array('status' =&gt; FALSE, 'message' =&gt; $e-&gt;getMessage());
  }
}


Update: debug
Getting access denied maybe another module add/alter your menu and add another access arguments then access content so in your callback function print you menu object and see something like :

  $menu_item = menu_get_item('api/json/select/programs');
  // print the menu array
  print_r($menu_item);
  // Print access arguments
  print_r($menu_item['access_arguments']);
  // Print access callback
  print_r($menu_item['access_callback']);