'missing_parameter', 'params' => $params] ); } // Find TwingleShop via get API $returnValues = civicrm_api3('TwingleShop', 'get', $params); $count = $returnValues['count']; // Check whether only a single TwingleShop is found if ($count != 1) { return civicrm_api3_create_error( "Expected one TwingleShop but found $count", ['error_code' => 'not_found', 'params' => $params] ); } return $returnValues['values'][$returnValues['id']]; }