Why can't I access my API?

curl http://192.168.88.1:8728

... and why can't I see the contents of the folder???

user@server:/# ls folder
:thinking::thinking::thinking:

there is absolutely not enough information for any advice/help...

It’s not a folder. I cannot access the api using curl.

It was an analogy. Read what @aldek wrote in bold.

it is completely unclear in your question what you want to get from: curl http://192.168.88.1:8728
and why did you decide that you don't have access to the API?

192.168.88.1 is the router ip. I want to access it, but I can’t.

Have you been able to connect to API before?

see also

Or REST API

Please read this: https://manual.mikrotik.com/docs/7.24/developer-guides/api/
If you try to make curl ``http://192.168.88.1:8728, you will not get a webpage or JSON response.

The RouterOS API protocol is binary, not HTTP.

OK, but i can't access the api with Ansible using api_modify, getting no route to host. Though can ping the IP.

Don’t keep me guessing...

  • do you have the API service enabled
  • do you have the correct settings in the firewall filters
  • what is your network layout, or at least the section with involved devices/containes
  • ....etc...

The API Service is enabled.
I have enabled an accept service in the firewall for port 8728.
I have a mac connected via LAN to the Router.

Only /export speaks the truth; all the rest are just empty words.

:face_with_raised_eyebrow: And I have to keep guessing.:

  • Why did you write about curl http://...

  • Is MAC an API client?

  • Is Ansible installed probably on a MAC with which modules and what is the configuration/settings

Please provide more information if you want help rather than ignoring...

config_backup.rsc (6.2 KB)

I wanted to try a curl to the API to test it.

The Mac is a MacBook Pro.

Ansible responds the following:

TASK [mikrotik : Set hostname of MikroTik router] *******************************************************************************************************************
[ERROR]: Task failed: Module failed: Error while connecting: [Errno 65] No route to host
Origin: /Users/ronnyforberger/IdeaProjects/mikrotik_configuration/mikrotik/tasks/main.yml:5:3

3 ################
4
5 - name: Set hostname of MikroTik router
    ^ column 3

fatal: [192.168.88.1]: FAILED! => {"changed": false, "connection": {"hostname": "192.168.88.1", "port": 8728, "ssl": false, "status": "Error while connecting: [Errno 65] No route to host", "username": "admin"}, "msg": "Error while connecting: [Errno 65] No route to host"}

Playbook/Role:

- name: Set password for mikrotik router
  community.routeros.api_modify:
    hostname: "{{ inventory_hostname }}"
    username: "{{ username }}"
    password: "{{ ansible_password }}"
    path: user
    data:
      - name: admin
        password: "{{ routeros.new_password }}"
    handle_absent_entries: ignore
    handle_entries_content: ignore
  no_log: true

You might want to check the previous questions/remarks again and then have a close look at those firewall rules...

Where ?

in IP->Firewall. I enabled port 8728 tcp for the service api. I put it before the drop rules.

Check your MAC Privacy & Security for Local Network and allow terminal access to LAN.

yeah, but ssh works.