We are trying to automate the process of creating credentails on Jenkins UI. We are using below script. While running the script getting 200 as response code but the credentails are not added/saved on jenkins UI. Can you please help us in this.
credentails.xml <com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl> <scope>GLOBAL</scope> <id>deploy-key</id> <description>This is an example from REST API</description> <username>wecoyote</username> <password>secret123</password> </com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl> test.py import requests from requests.auth import HTTPBasicAuth head = {'Content-Type': 'application/xml'} jenkins_crumb_api = "https://username:token@jenkins_server/crumbIssuer/ api/json" response = requests.get(jenkins_crumb_api) if (response.status_code == 200): print(response.status_code) head['Jenkins-Crumb'] = response.json()["crumb"] head = {'Content-Type': 'application/xml'} response = requests.post(" https://jenkins_server/credentails/store/system/domain/domain_name/newCredentails ", auth=HTTPBasicAuth('username', 'token'), headers=head, data= "credentails.xml") print(response.status_code) Jenkins version: 2.319.3. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJWGB6oJav-FiMU5-Eqmt-56CGnt%3Dh2X%2BqEZAX4wSe2qAq3m_g%40mail.gmail.com.