shijl0925 / python-sonarqube-api

Python Client library for interacting with Community, Developer, and Enterprise Editions SonarQube's REST APIs and SonarCloud's REST APIs.
https://python-sonarqube-pro-api.readthedocs.io/en/latest/
GNU Affero General Public License v3.0
133 stars 77 forks source link

Restore quality profile failes with message: Error in request. Possibly validation error [400]: A backup file must be provided #45

Closed Jeddumania closed 2 years ago

Jeddumania commented 2 years ago

When using qualityprofiles.restore_quality_profile() method and providing proper xml file with backup, the method failes with message:

Error in request. Possibly validation error [400]: A backup file must be provided

Code snippet: with open('C:\\restore.xml', 'r') as f: sonar.qualityprofiles.restore_quality_profile(backup=f.read())

restore.xml: <?xml version='1.0' encoding='UTF-8'?><profile><name>BackUp</name><language>java</language><rules/></profile>

I believe it is caused because backup file is passed as query parameter (so - /api/qualityprofiles/restore?backup=<?xml...) not as body:form-data parameter

shijl0925 commented 2 years ago

I fix this bug in version 1.2.7, please update it.