<linkrel="next"title="community.routeros.api_modify module – Modify data at paths with API"href="api_modify_module.html"/>
<linkrel="prev"title="community.routeros.api_find_and_modify module – Find and modify information using the API"href="api_find_and_modify_module.html"/><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
</head>
<bodyclass="wy-body-for-nav"><!-- extra body elements for Ansible beyond RTD Sphinx Theme -->
<liclass="toctree-l1"><aclass="reference internal"href="docsite/api-guide.html">How to connect to RouterOS devices with the RouterOS API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="docsite/ssh-guide.html">How to connect to RouterOS devices with SSH</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="docsite/quoting.html">How to quote and unquote commands and arguments</a></li>
</ul>
<ulclass="current">
<liclass="toctree-l1"><aclass="reference internal"href="api_module.html">community.routeros.api module – Ansible module for RouterOS API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_facts_module.html">community.routeros.api_facts module – Collect facts from remote devices running MikroTik RouterOS using the API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_find_and_modify_module.html">community.routeros.api_find_and_modify module – Find and modify information using the API</a></li>
<liclass="toctree-l1 current"><aclass="current reference internal"href="#">community.routeros.api_info module – Retrieve information from API</a><ul>
<liclass="toctree-l1"><aclass="reference internal"href="api_modify_module.html">community.routeros.api_modify module – Modify data at paths with API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="command_module.html">community.routeros.command module – Run commands on remote devices running MikroTik RouterOS</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="routeros_cliconf.html">community.routeros.routeros cliconf – Use routeros cliconf to run command on MikroTik RouterOS platform</a></li>
</ul>
<ul>
<liclass="toctree-l1"><aclass="reference internal"href="join_filter.html">community.routeros.join filter – Join a list of arguments to a command</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="list_to_dict_filter.html">community.routeros.list_to_dict filter – Convert a list of arguments to a dictionary</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="quote_argument_filter.html">community.routeros.quote_argument filter – Quote an argument</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="quote_argument_value_filter.html">community.routeros.quote_argument_value filter – Quote an argument value</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="split_filter.html">community.routeros.split filter – Split a command into arguments</a></li>
<liclass="breadcrumb-item active">community.routeros.api_info module – Retrieve information from API</li>
<liclass="wy-breadcrumbs-aside">
<!-- User defined GitHub URL -->
<ahref="https://github.com/ansible-collections/community.routeros/edit/main/plugins/modules/api_info.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!—%20Your%20description%20here%20–%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr"class="fa fa-github"> Edit on GitHub</a>
<h1>community.routeros.api_info module – Retrieve information from API<aclass="headerlink"href="#community-routeros-api-info-module-retrieve-information-from-api"title="Permalink to this heading"></a></h1>
<p>This module is part of the <aclass="reference external"href="https://galaxy.ansible.com/community/routeros">community.routeros collection</a> (version 2.5.0).</p>
You need further requirements to be able to use this module,
see <aclass="reference internal"href="#ansible-collections-community-routeros-api-info-module-requirements"><spanclass="std std-ref">Requirements</span></a> for details.</p>
<p>To use it in a playbook, specify: <codeclass="code docutils literal notranslate"><spanclass="pre">community.routeros.api_info</span></code>.</p>
</div>
<pclass="ansible-version-added">New in community.routeros 2.2.0</p>
<h2><aclass="toc-backref"href="#id1">Synopsis</a><aclass="headerlink"href="#synopsis"title="Permalink to this heading"></a></h2>
<ulclass="simple">
<li><p>Allows to retrieve information for a path using the API.</p></li>
<li><p>This can be used to backup a path to restore it with the <aclass="reference internal"href="api_modify_module.html#ansible-collections-community-routeros-api-modify-module"><spanclass="std std-ref">community.routeros.api_modify</span></a> module.</p></li>
<li><p>Entries are normalized, dynamic and builtin entries are not returned. Use the <em>handle_disabled</em> and <em>hide_defaults</em> options to control normalization, the <em>include_dynamic</em> and <em>include_builtin</em> options to also return dynamic resp. builtin entries, and use <em>unfiltered</em> to return all fields including counters.</p></li>
<li><p><strong>Note</strong> that this module is still heavily in development, and only supports <strong>some</strong> paths. If you want to support new paths, or think you found problems with existing paths, please first <aclass="reference external"href="https://github.com/ansible-collections/community.routeros/issues/">create an issue in the community.routeros Issue Tracker</a>.</p></li>
</ul>
</section>
<sectionid="requirements">
<spanid="ansible-collections-community-routeros-api-info-module-requirements"></span><h2><aclass="toc-backref"href="#id2">Requirements</a><aclass="headerlink"href="#requirements"title="Permalink to this heading"></a></h2>
<p>The below requirements are needed on the host that executes this module.</p>
<aclass="ansibleOptionLink"href="#parameter-ca_path"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">path</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>PEM formatted file that contains a CA certificate to be used for certificate validation.</p>
<p>See also <em>validate_cert_hostname</em>. Only used when <em>tls=true</em> and <em>validate_certs=true</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-encoding"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.1.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Use the specified encoding when communicating with the RouterOS device.</p>
<p>Default is <codeclass="docutils literal notranslate"><spanclass="pre">ASCII</span></code>. Note that <codeclass="docutils literal notranslate"><spanclass="pre">UTF-8</span></code> requires librouteros 3.2.1 or newer.</p>
<aclass="ansibleOptionLink"href="#parameter-force_no_cert"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.4.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> to connect without a certificate when <em>tls=true</em>.</p>
<p>See also <em>validate_certs</em>.</p>
<p><strong>Note:</strong> this forces the use of anonymous Diffie-Hellman (ADH) ciphers. The protocol is susceptible to Man-in-the-Middle attacks, because the keys used in the exchange are not authenticated. Instead of simply connecting without a certificate to “make things work” have a look at <em>validate_certs</em> and <em>ca_path</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-handle_disabled"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>How to handle unset values.</p>
<p><codeclass="docutils literal notranslate"><spanclass="pre">exclamation</span></code> prepends the keys with <codeclass="docutils literal notranslate"><spanclass="pre">!</span></code> in the output with value <codeclass="docutils literal notranslate"><spanclass="pre">null</span></code>.</p>
<p><codeclass="docutils literal notranslate"><spanclass="pre">null-value</span></code> uses the regular key with value <codeclass="docutils literal notranslate"><spanclass="pre">null</span></code>.</p>
<p><codeclass="docutils literal notranslate"><spanclass="pre">omit</span></code> omits these values from the result.</p>
<aclass="ansibleOptionLink"href="#parameter-hide_defaults"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Whether to hide default values.</p>
<aclass="ansibleOptionLink"href="#parameter-hostname"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
<aclass="ansibleOptionLink"href="#parameter-include_builtin"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.4.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Whether to include builtin values.</p>
<p>By default, they are not returned, and the <codeclass="docutils literal notranslate"><spanclass="pre">builtin</span></code> keys are omitted.</p>
<p>If set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>, they are returned as well, and the <codeclass="docutils literal notranslate"><spanclass="pre">builtin</span></code> keys are returned as well.</p>
<aclass="ansibleOptionLink"href="#parameter-include_dynamic"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Whether to include dynamic values.</p>
<p>By default, they are not returned, and the <codeclass="docutils literal notranslate"><spanclass="pre">dynamic</span></code> keys are omitted.</p>
<p>If set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>, they are returned as well, and the <codeclass="docutils literal notranslate"><spanclass="pre">dynamic</span></code> keys are returned as well.</p>
<aclass="ansibleOptionLink"href="#parameter-password"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>RouterOS user password.</p>
<aclass="ansibleOptionLink"href="#parameter-path"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Path to query.</p>
<p>An example value is <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code>. This is equivalent to running <codeclass="docutils literal notranslate"><spanclass="pre">/ip</span><spanclass="pre">address</span><spanclass="pre">print</span></code> in the RouterOS CLI.</p>
<aclass="ansibleOptionLink"href="#parameter-port"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>RouterOS api port. If <em>tls</em> is set, port will apply to TLS/SSL connection.</p>
<p>Defaults are <codeclass="docutils literal notranslate"><spanclass="pre">8728</span></code> for the HTTP API, and <codeclass="docutils literal notranslate"><spanclass="pre">8729</span></code> for the HTTPS API.</p>
<aclass="ansibleOptionLink"href="#parameter-timeout"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.3.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Timeout for the request.</p>
<aclass="ansibleOptionLink"href="#parameter-tls"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-aliases">aliases: ssl</span></p>
<aclass="ansibleOptionLink"href="#parameter-unfiltered"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Whether to output all fields, and not just the ones supported as input for <aclass="reference internal"href="api_modify_module.html#ansible-collections-community-routeros-api-modify-module"><spanclass="std std-ref">community.routeros.api_modify</span></a>.</p>
<p>Unfiltered output can contain counters and other state information.</p>
<aclass="ansibleOptionLink"href="#parameter-username"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
<aclass="ansibleOptionLink"href="#parameter-validate_cert_hostname"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> to validate hostnames in certificates.</p>
<p>See also <em>validate_certs</em>. Only used when <em>tls=true</em> and <em>validate_certs=true</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-validate_certs"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> to skip validation of TLS certificates.</p>
<p>See also <em>validate_cert_hostname</em>. Only used when <em>tls=true</em>.</p>
<p><strong>Note:</strong> instead of simply deactivating certificate validations to “make things work”, please consider creating your own CA certificate and using it to sign certificates used for your router. You can tell the module about your CA certificate with the <em>ca_path</em> option.</p>
<td><divclass="ansible-option-cell"><p>Use <codeclass="docutils literal notranslate"><spanclass="pre">group/community.routeros.api</span></code> in <codeclass="docutils literal notranslate"><spanclass="pre">module_defaults</span></code> to set defaults for this module.</p>
<td><divclass="ansible-option-cell"><p>Can run in <codeclass="docutils literal notranslate"><spanclass="pre">check_mode</span></code> and return changed status prediction without modifying target.</p>
<td><divclass="ansible-option-cell"><p>Will return details on what has changed (or possibly needs changing in <codeclass="docutils literal notranslate"><spanclass="pre">check_mode</span></code>), when in diff mode.</p>
<dt><aclass="reference internal"href="api_facts_module.html#ansible-collections-community-routeros-api-facts-module"><spanclass="std std-ref">community.routeros.api_facts</span></a></dt><dd><p>Collect facts from remote devices running MikroTik RouterOS using the API.</p>
<dt><aclass="reference internal"href="api_find_and_modify_module.html#ansible-collections-community-routeros-api-find-and-modify-module"><spanclass="std std-ref">community.routeros.api_find_and_modify</span></a></dt><dd><p>Find and modify information using the API.</p>
<dt><aclass="reference internal"href="api_modify_module.html#ansible-collections-community-routeros-api-modify-module"><spanclass="std std-ref">community.routeros.api_modify</span></a></dt><dd><p>Modify data at paths with API.</p>
<dt><aclass="reference internal"href="docsite/api-guide.html#ansible-collections-community-routeros-docsite-api-guide"><spanclass="std std-ref">How to connect to RouterOS devices with the RouterOS API</span></a></dt><dd><p>How to connect to RouterOS devices with the RouterOS API</p>
</dd>
</dl>
</div>
</section>
<sectionid="examples">
<h2><aclass="toc-backref"href="#id6">Examples</a><aclass="headerlink"href="#examples"title="Permalink to this heading"></a></h2>
<spanclass="p p-Indicator">-</span><spanclass="w"></span><spanclass="nt">name</span><spanclass="p">:</span><spanclass="w"></span><spanclass="l l-Scalar l-Scalar-Plain">Print data for IP addresses</span><spanclass="w"></span>
<h2><aclass="toc-backref"href="#id7">Return Values</a><aclass="headerlink"href="#return-values"title="Permalink to this heading"></a></h2>
<p>Common return values are documented <aclass="reference external"href="https://docs.ansible.com/ansible/devel/reference_appendices/common_return_values.html#common-return-values"title="(in Ansible vdevel)"><spanclass="xref std std-ref">here</span></a>, the following are the fields unique to this module:</p>
<aclass="ansibleOptionLink"href="#return-result"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A list of all elements for the current path.</p>
<ahref="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=bug_report.md"aria-role="button"target="_blank"rel="noopener external">Submit a bug report</a>
<ahref="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=feature_request.md"aria-role="button"target="_blank"rel="noopener external">Request a feature</a>
<ahref="api_find_and_modify_module.html"class="btn btn-neutral float-left"title="community.routeros.api_find_and_modify module – Find and modify information using the API"accesskey="p"rel="prev"><spanclass="fa fa-arrow-circle-left"aria-hidden="true"></span> Previous</a>
<ahref="api_modify_module.html"class="btn btn-neutral float-right"title="community.routeros.api_modify module – Modify data at paths with API"accesskey="n"rel="next">Next <spanclass="fa fa-arrow-circle-right"aria-hidden="true"></span></a>