Right way to start replication task using API?

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
Hi,

I'm trying to run this using a bash script to start a replication task:
curl -s -k --netrc-file "/path/to/my/netrc.file" -X POST "http://192.168.0.1/api/v2.0/replication/id/39/run" -H "accept: */*" -H "Content-Type: application/json" -d "{}"

But the job created by this seems to fail and running #curl -s -k --netrc-file "/path/to/my/netrc.file" -X GET "http://192.168.0.1/api/v2.0/replication/id/39" -H "accept: */*" -H "Content-Type: application/json" | jq shows me job details like this:
Code:
"job": {
      "id": 49215,
      "method": "replication.run",
      "arguments": [
        "39",
        {}
      ],
      "logs_path": "/tmp/middlewared/jobs/49215.log",
      "logs_excerpt": "",
      "progress": {
        "percent": null,
        "description": null,
        "extra": null
      },
      "result": null,
      "error": "[really_run] Not a boolean",
      "exception": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.7/site-packages/middlewared/job.py\", line 349, in run\n    await self.future\n  File \"/usr/local/lib/python3.7/site-packages/middlewared/job.py\", line 385, in __run_body\n    rv = await self.method(*([self] + args))\n  File \"/usr/local/lib/python3.7/site-packages/middlewared/schema.py\", line 960, in nf\n    args, kwargs = clean_and_validate_args(args, kwargs)\n  File \"/usr/local/lib/python3.7/site-packages/middlewared/schema.py\", line 918, in clean_and_validate_args\n    value = attr.clean(args[args_index + i])\n  File \"/usr/local/lib/python3.7/site-packages/middlewared/schema.py\", line 374, in clean\n    raise Error(self.name, 'Not a boolean')\nmiddlewared.schema.Error: [really_run] Not a boolean\n",
      "exc_info": {
        "type": "Error",
        "extra": null
      },
      "state": "FAILED",
      "time_started": {
        "$date": 1611424535462
      },
      "time_finished": {
        "$date": 1611424535465
      }
    }


What am I doing wrong? Do I need to pass more data or something like that? I just want the replication task to be run like if I press the "run now" button in GUI but using CLI instead.
 
Last edited:
Top