QualityprofilesService.restore don't work

QualityprofilesService.restore don’t work, it should do a form-data POST.

it should be something like this:

Path backup = Files.write(Files.createTempFile("backup", ".xml"), 
                            request.getBackup().getBytes());
call(
    new PostRequest(path("restore"))
        .setPart("backup", new Part(MediaTypes.JSON, backup.toFile()))
).content();

Hey @Philippe_GRANET

How are you trying to use this? Are you trying to use the POST api/qualityprofiles/restore Web API?

I’m able to use it as seen below, against Community Build 25.3.

colin@MAC-L0251 macosx-universal-64 % curl -X POST -u username:password 'http://localhost:9000/api/qualityprofiles/restore' --form backup=@/Users/colin/Downloads/bb9c7795-57c6-43a1-a679-8834ac8bc7fe.xml 
{"profile":{"key":"73c6fbd2-2e2c-4e66-926d-1c692c92ca67","name":"KotlinQP","language":"kotlin","isDefault":false,"isInherited":false,"languageName":"Kotlin"},"ruleSuccesses":124,"ruleFailures":0}**%**```

Yes it works with curl, but I want to use the Java API that actually doesn’t work

Hey Philippe.

I expect that since SonarQube itself is using this method to perform the restore, it should work.

Could you share a reproducer (the code you have written yourself) where it doesn’t work? What is the error you get?

It’s the Java client that don’t work, not server part: