Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error restoring backup via API using a file #11452

Open
2 tasks done
nanoandrew4 opened this issue Mar 25, 2024 · 0 comments
Open
2 tasks done

Error restoring backup via API using a file #11452

nanoandrew4 opened this issue Mar 25, 2024 · 0 comments
Labels

Comments

@nanoandrew4
Copy link

nanoandrew4 commented Mar 25, 2024

Before you start please confirm the following.

Problem Description

The API documentation for restoring from a backup via file (not S3) is unclear. Initially, looking at this documentation I figured that since the endpoint consumes application/json, I would have to send the file as an array of bytes, or perhaps integers representing 4-8 byte chunks given the use of the integer type in the Swagger definition. So I processed the file into a byte array, created a JSON file that included said bytes, and ran the following command:

curl -X POST -k https://127.0.0.1:9443/api/restore -d "@/tmp/restore.json"

However, the server gives the following error: {"message":"Invalid request payload","details":"request Content-Type isn't multipart/form-data"}

Though it went against the documentation, it made sense for the endpoint to expect a multipart form, since having to guess how to send an array of integers seemed too obtuse, and sending the file as part of a form made more sense. So I grabbed the field names from the swagger docs, and sent the following request:

curl -X POST -k -i -F fileContent=@portainer-backup.tar.gz -F fileName=portainer-backup.tar.gz https://127.0.0.1:9443/api/restore

But the server returns the following error: {"message":"Invalid request payload","details":"http: no such file"}

I searched online, as well as through the open and closed issues, and though #10991 also refers to this API endpoint, I am not looking to use it with ansible or troubleshoot a specific problem, I just want to understand how the API expects the input so I can restore via the API

Expected Behavior

Clear documentation or an example of how to use the /restore endpoint of the API, since it the current documentation seems to have nothing to do with the actual endpoint

Actual Behavior

The documentation seems to be inaccurate, rendering the endpoint useless, since there is no easy way to figure out how to use it

Steps to Reproduce

  1. Create a new portainer-ee container
  2. Attempt to restore via the /restore API endpoint, using the current documentation as a reference

Portainer logs or screenshots

No response

Portainer version

2.20.0

Portainer Edition

Business Edition (BE/EE) with Starter license

Platform and Version

Docker 26.0.0

OS and Architecture

Debian 10

Browser

No response

What command did you use to deploy Portainer?

services:
  portainer-agent:
    image: portainer/agent:2.19.4
    restart: always
    ports:
      - "9001:9001"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  portainer-ee:
    image: portainer/portainer-ee:latest
    command: -H unix:///var/run/docker.sock
    restart: always
    ports:
      - "9443:9443"
    depends_on:
      - portainer-agent
    networks:
      - private
      - public
    environment:
      - VIRTUAL_HOST=<my-server>
      - VIRTUAL_PORT=9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

networks:
  private:
    external: true
  public:
    internal: false

volumes:
  portainer_data:
    external: true

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant