Api
Version
mediamosa-21Class
mediamosa_rest_call_aut_group_create_hostnamesCode
File: /sites/all/modules/mediamosa/modules/aut/mediamosa_aut.rest.inc
<?php
/**
* URI: /autorisation_group/$groupname/hostname/create
* Method: POST
*/
class mediamosa_rest_call_aut_group_create_hostnames extends mediamosa_rest_call {
// ------------------------------------------------------------------ Consts.
// Rest vars;
const GROUPNAME = 'groupname';
const HOSTNAME = 'hostname';
// ------------------------------------------------------------------ Functions (public).
public function get_var_setup() {
$a_var_setup = array();
$a_var_setup[mediamosa_rest_call::VARS][self::GROUPNAME] = array(
mediamosa_rest_call::VAR_TYPE => mediamosa_type::TYPE_STRING,
mediamosa_rest_call::VAR_IS_REQUIRED => mediamosa_rest_call::VAR_IS_REQUIRED_YES,
mediamosa_rest_call::VAR_DESCRIPTION => 'The name of the group, which shared the hostname(s).',
);
$a_var_setup[mediamosa_rest_call::VARS][self::HOSTNAME] = array(
mediamosa_rest_call::VAR_TYPE => mediamosa_type::TYPE_STRING,
mediamosa_rest_call::VAR_IS_REQUIRED => mediamosa_rest_call::VAR_IS_REQUIRED_YES,
mediamosa_rest_call::VAR_IS_ARRAY => mediamosa_rest_call::VAR_IS_ARRAY_YES,
mediamosa_rest_call::VAR_DESCRIPTION => "The hostname that the group should be linked.\n\nIn case of multiple hostnames you can using the '[]' notation",
);
// Enrich with required REST vars.
return self::get_var_setup_default($a_var_setup);
}
public function do_call() {
$o_mediamosa = mediamosa::get();
// Get the app id(s).
$a_app_ids = $this->get_param_value_app();
$group_name = $this->get_param_value(self::GROUPNAME);
$a_host_names = $this->get_param_value(self::HOSTNAME);
// First is always the main app.
$app_id = reset($a_app_ids);
// Get the group.
$a_result = mediamosa_aut_group::create_hostnames_for_group($app_id, $group_name, $a_host_names);
foreach ($a_result as $a_row) {
$o_mediamosa->add_item($a_row);
}
}
}