Can't create filtered replication rule through Harbor API

53 Views Asked by At

I'm using the Swagger API tool built into harbor. I've successfully created replication rules using the API, but the problem comes when I try to add a filter. From trial and error, I've managed to work out that "type" can be something like name or tag. But when I try and add anything into value I get ""BAD_REQUEST", "message": "the type of filter value isn't string".

It seems to indicate that value needs to be set as "value": "hello-world", but that won't even execute. "value" needs to be an object containing a key value pair it seems (that's the only way it will even execute), but whatever is placed in there, it complains it's not a string. I've scoured for examples and I can't find any. How do I have to format the value parameter to get this working?

  "filters": [
{
  "decoration": "matches",
  "type": "name",
  "value": {"name": "hello-world"}
}

],

1

There are 1 best solutions below

0
Soop On

As I suspected, it's actually an error in the UI. I imported the same json I was trying to use in swagger, and invoked it using the harborapi python library, and it worked fine.

Swagger just won't let you invoke the correct syntax