API version: dev

---

# `backup:fetch`

Downloads a backup archive from a remote HTTP(S) URL and extracts it into local backup storage
under `name`, so it can subsequently be restored with `backup:load`.

Both arguments are required: `name` is the local name to store the backup under, `source` is the
URL of a ZIP archive (as produced by zipping a `backup:create` output folder). The command
downloads the archive to a temporary file, prints its size and SHA1 checksum, then searches the
archive for the `summary.json` that marks the backup's root folder and verifies the `node`,
`relation`, and `file` folders exist there before extracting - it fails if any of these checks do
not pass.

Options:

- `-f`, `--force` - overwrites a local backup with the same `name` if one already exists. Without
  it, the command aborts when the name is already taken.

The temporary archive is removed again once extraction finishes successfully; if the command fails
before that point (for example because required folders are missing from the archive), the
downloaded temporary file is left behind on disk.

## Help

```bash
php bin/console backup:fetch --help
```

```text
Description:
  Downloads backup from remote source to local storage.

Usage:
  backup:fetch [options] [--] <name> <source>

Arguments:
  name                    Name of the backup
  source                  URL to the remote backup, HTTP(S) protocol, must be ZIP archive

Options:
  -f, --force|--no-force  If active, will overwrite existing backups with the same name
  -h, --help              Display help for the given command. When no command is given display help for the list command
      --silent            Do not output any message
  -q, --quiet             Only errors are displayed. All other output is suppressed
  -V, --version           Display this application version
      --ansi|--no-ansi    Force (or disable --no-ansi) ANSI output
  -n, --no-interaction    Do not ask any interactive question
  -e, --env=ENV           The Environment name. [default: "prod"]
      --no-debug          Switch off debug mode.
      --profile           Enables profiling (requires debug).
  -v|vv|vvv, --verbose    Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

## Example

```bash
php bin/console backup:fetch reference-dataset https://github.com/ember-nexus/reference-dataset/archive/refs/tags/0.0.12.zip
```

```text
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.1.31, production mode

  Backup Fetch

┌ Downloading and inspecting archive ───────────────────────────────────────────
│ Loaded archive is 313.67 KB big.
│ SHA1 sum of file is f232952d9fc8a742d7f8441e97d3ceeafb14622a.
│ Found backup inside ZIP in folder reference-dataset-0.0.19.
│ Required folders exist.
└ Download complete.

┌ Extracting nodes ─────────────────────────────────────────────────────────────
└ All nodes extracted.

┌ Extracting relations ─────────────────────────────────────────────────────────
└ All relations extracted.

┌ Extracting files ─────────────────────────────────────────────────────────────
└ All files extracted.

┌ Extracting summary.json ──────────────────────────────────────────────────────
└ summary.json extracted.

┌ Cleaning up temporary files ──────────────────────────────────────────────────
└ Cleanup complete.

▶ Fetched backup successfully.
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [backup:create](/command/backup-create.md)

Next: [backup:list](/command/backup-list.md)
