Skip to content

Rest API

Enable The API

The API is enabled internally by default, but you still must open the port for external access. Follow these steps:

Why is the REST API on internally?

The REST API is used internally for Docker Healthchecks. However, if do not open the port via Docker, then all the endpoints will remain unreachable.

1. Map the port

You need to ensure the port is opened by Docker for the Nautical container. See the highlighted sections of this example Nautical config:

services:
  nautical-backup:
    image: minituff/nautical-backup:2.9
    container_name: nautical-backup
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /config:/config
      - /source:/app/source
    ports:
      - "8069:8069/tcp"
docker run -d \
  --name nautical-backup \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /config:/config \
  -v /source:/app/source \
  -v /destination:/app/destination \
  -p 8069:8069/tcp \
  minituff/nautical-backup:2.9

2. Verify it works

To view the API, go to http://localhost:8069/docs in your browser.

Authentication

The default login is admin / password. This can be changed here.

curl -X GET \
  'http://localhost:8069/auth' \
  --header 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='

Use this site to generate a Base64 token.

Dashboard

GET /api/v1/nautical/dashboard

This endpoint is the quickest way to get a glimpse into everything Nautical has going on.

Example response
{
  "next_cron": {
    "1": [
      "Monday, November 20, 2023 at 04:00 AM",
      "11/20/23 04:00"
    ],
    "2": [
      "Tuesday, November 21, 2023 at 04:00 AM",
      "11/21/23 04:00"
    ],
    "3": [
      "Wednesday, November 22, 2023 at 04:00 AM",
      "11/22/23 04:00"
    ],
    "4": [
      "Thursday, November 23, 2023 at 04:00 AM",
      "11/23/23 04:00"
    ],
    "5": [
      "Friday, November 24, 2023 at 04:00 AM",
      "11/24/23 04:00"
    ],
    "cron": "0 4 * * *",
    "tz": "America/Los_Angeles"
  },
  "next_run": "11/20/23 04:00",
  "last_cron": "11/19/23 04:00",
  "number_of_containers": "1",
  "completed": "0",
  "skipped": "1",
  "errors": "0",
  "last_backup_seconds_taken": "15",
  "backup_running": "false"
}

Next CRON

GET /api/v1/nautical/next_cron/{occurrences}

{occurrences} = integer between 1 and 100

Get the next n scheduled times Nautical will run.

Example response
{
  "1": [
    "Monday, November 20, 2023 at 04:00 AM",
    "11/20/23 04:00"
  ],
  "2": [
    "Tuesday, November 21, 2023 at 04:00 AM",
    "11/21/23 04:00"
  ],
  "cron": "0 4 * * *",
  "tz": "America/Los_Angeles"
}

Start Backup

POST /api/v1/nautical/start_backup

Start a backup now. The API will not respond until the backup has completed.

All the Variables and Labels are respected.

Example response
{
  "message": "Nautical Backup completed successfully"
}

Kickoff Backup

POST /api/v1/nautical/kickoff_backup

Start a backup now in the background. The API will respond immediately.

All the Variables and Labels are respected.

Example response
{
  "message": "Nautical Backup started successfully"
}