Cygnus subscription bad request - flume

I have already configured a subscription in orion to cygnus when an entity is updated in the context broker. The orion agent has a logger sink by default. This is the subscribeContext:
$ (curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"entities": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1"
}
],
"attributes": [
"pressure",
"temperature"
],
"reference": "http://172.17.0.3:5050/notify",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"pressure"
]
}
],
"throttling": "PT1S"
}
EOF
When I update the entity Room1, an event is sent to Cygnus but I have a bad request because of a Json invalid syntax:
org.apache.flume.source.http.HTTPBadRequestException: Request has invalid JSON Syntax.
at org.apache.flume.source.http.JSONHandler.getEvents(JSONHandler.java:119)
at org.apache.flume.source.http.HTTPSource$FlumeHTTPServlet.doPost(HTTPSource.java:184)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:814)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
at com.google.gson.Gson.fromJson(Gson.java:806)
at com.google.gson.Gson.fromJson(Gson.java:761)
at org.apache.flume.source.http.JSONHandler.getEvents(JSONHandler.java:117)
... 16 more
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
at com.google.gson.stream.JsonReader.expect(JsonReader.java:339)
Any ideas of what is happening??
Thanks in advance.

Related

GitHub webhook can't connect to Jenkins inside VPN?

I am setting up continuous integration using Jenkins and GitHub Enterprise.
So far I have been able to easily create Jenkins projects and run jobs regularly.
Jenkins is using SSH public/private keys to authenticate and clone GitHub repos.
Jenkins runs on a Linux server that is inside my company's VPN network.
My next step is to configure Jenkins/GitHub so that each git push to GitHub would trigger a Jenkins build job. I have set up the post-commit webhook on GitHub, and enabled the GitHub hook trigger for GITScm polling checkbox in my Jenkins projects.
However, GitHub fails to connect to Jenkins.
Here is the log:
We couldn’t deliver this payload: failed to connect
{
"zen": "Design for failure.",
"hook_id": 287451636,
"hook": {
"type": "Repository",
"id": 287451636,
"name": "web",
"active": true,
"events": [
"push"
],
"config": {
"content_type": "json",
"insecure_ssl": "0",
"url": "http://1.2.3.4/jenkins/github-webhook/"
},
"updated_at": "2021-03-19T07:45:12Z",
"created_at": "2021-03-19T07:45:12Z",
"url": "https://api.github.com/repos/mycompany/my_repo/hooks/287451636",
"test_url": "https://api.github.com/repos/mycompany/my_repo/hooks/287451636/test",
"ping_url": "https://api.github.com/repos/mycompany/my_repo/hooks/287451636/pings",
"last_response": {
"code": null,
"status": "unused",
"message": null
}
},
"repository": {
"id": 347030450,
"node_id": "MDEwOlJlcG9zaXRvcnkzNDcwMzA0NTA=",
"name": "my_repo",
"full_name": "mycompany/my_repo",
"private": true,
"owner": {
"login": "mycompany",
"id": 11980925,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjExOTgwOTI1",
"avatar_url": "https://avatars.githubusercontent.com/u/11980925?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mycompany",
"html_url": "https://github.com/mycompany",
"followers_url": "https://api.github.com/users/mycompany/followers",
"following_url": "https://api.github.com/users/mycompany/following{/other_user}",
"gists_url": "https://api.github.com/users/mycompany/gists{/gist_id}",
"starred_url": "https://api.github.com/users/mycompany/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/mycompany/subscriptions",
"organizations_url": "https://api.github.com/users/mycompany/orgs",
"repos_url": "https://api.github.com/users/mycompany/repos",
"events_url": "https://api.github.com/users/mycompany/events{/privacy}",
"received_events_url": "https://api.github.com/users/mycompany/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/mycompany/my_repo",
"description": "My test repo.",
"fork": false,
"url": "https://api.github.com/repos/mycompany/my_repo",
"forks_url": "https://api.github.com/repos/mycompany/my_repo/forks",
"keys_url": "https://api.github.com/repos/mycompany/my_repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/mycompany/my_repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/mycompany/my_repo/teams",
"hooks_url": "https://api.github.com/repos/mycompany/my_repo/hooks",
"issue_events_url": "https://api.github.com/repos/mycompany/my_repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/mycompany/my_repo/events",
"assignees_url": "https://api.github.com/repos/mycompany/my_repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/mycompany/my_repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/mycompany/my_repo/tags",
"blobs_url": "https://api.github.com/repos/mycompany/my_repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/mycompany/my_repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/mycompany/my_repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/mycompany/my_repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/mycompany/my_repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/mycompany/my_repo/languages",
"stargazers_url": "https://api.github.com/repos/mycompany/my_repo/stargazers",
"contributors_url": "https://api.github.com/repos/mycompany/my_repo/contributors",
"subscribers_url": "https://api.github.com/repos/mycompany/my_repo/subscribers",
"subscription_url": "https://api.github.com/repos/mycompany/my_repo/subscription",
"commits_url": "https://api.github.com/repos/mycompany/my_repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/mycompany/my_repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/mycompany/my_repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/mycompany/my_repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/mycompany/my_repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/mycompany/my_repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/mycompany/my_repo/merges",
"archive_url": "https://api.github.com/repos/mycompany/my_repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/mycompany/my_repo/downloads",
"issues_url": "https://api.github.com/repos/mycompany/my_repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/mycompany/my_repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/mycompany/my_repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/mycompany/my_repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/mycompany/my_repo/labels{/name}",
"releases_url": "https://api.github.com/repos/mycompany/my_repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/mycompany/my_repo/deployments",
"created_at": "2021-03-12T10:40:44Z",
"updated_at": "2021-03-18T13:59:52Z",
"pushed_at": "2021-03-18T13:59:49Z",
"git_url": "git://github.com/mycompany/my_repo.git",
"ssh_url": "git#github.com:mycompany/my_repo.git",
"clone_url": "https://github.com/mycompany/my_repo.git",
"svn_url": "https://github.com/mycompany/my_repo",
"homepage": null,
"size": 3,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Makefile",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "main"
},
"sender": {
"login": "MyLogin",
"id": 63738097,
"node_id": "MDQ6VXNlcjYzNzM4MDk3",
"avatar_url": "https://avatars.githubusercontent.com/u/13818097?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/MyLogin",
"html_url": "https://github.com/MyLogin",
"followers_url": "https://api.github.com/users/MyLogin/followers",
"following_url": "https://api.github.com/users/MyLogin/following{/other_user}",
"gists_url": "https://api.github.com/users/MyLogin/gists{/gist_id}",
"starred_url": "https://api.github.com/users/MyLogin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/MyLogin/subscriptions",
"organizations_url": "https://api.github.com/users/MyLogin/orgs",
"repos_url": "https://api.github.com/users/MyLogin/repos",
"events_url": "https://api.github.com/users/MyLogin/events{/privacy}",
"received_events_url": "https://api.github.com/users/MyLogin/received_events",
"type": "User",
"site_admin": false
}
}
What could be the problem?
Well the problem is exactly because github cannot access your internal network.
There's an article in Jenkins Community Blog where author suggests using smee (released under ISC License) for webhooks forwarding.
If using smee to deliver webhooks from GitHub to your VPNed Jenkins (you set up Github to send events to smee.io, and than you use the Smee client to retrieve the events and use them internally on Jenknins), here is a quick way to set it up.
Go to Smee.io and get yourself a "channel", write down the URL you get (for example https://smee.io/Wua8D46nBvJ63nPP).
Install Smee on your Jenkins: sudo npm install --global smee-client
Configure the internal forwarding: smee -u https://smee.io/Wua8D46nBvJ63nPP --path /github-webhook/ --port 8080
Go to your GitHub repository: Settings->Webhooks->Add webhook, and paste the URL under "Payload URL", choose Content type "application/json".
Setup your Smee to run as a service on Jenkins, to start at boot time. You will need two files:
Init script /etc/init.d/smee
systemctl service description file /etc/systemd/system/smee.service
/etc/init.d/smee:
#! /bin/sh
### BEGIN INIT INFO
# Provides: smee
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start SMEE daemon at boot time
# Description: Forwards GitHub webhook notifications to Jenkins.
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/bin/smee
PIDFILE=/var/run/smee.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting smee" "smee"
start_daemon -p $PIDFILE $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping smee" "smee"
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/smee {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0
/etc/systemd/system/smee.service:
[Unit]
Description=smee.io webhook delivery from GitHub
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=jenkins
ExecStart=/usr/bin/smee -u https://smee.io/Wua8D46nBvJ63nPP --path /jenkins/github-webhook/ --port 8080
[Install]
WantedBy=multi-user.target
Start the service: sudo /etc/init.d/smee start
Check the status: sudo /etc/init.d/smee status
The notifications from your repository should now be sent to Jenkins and Jenkins should be able to see and handle them. To quickly check if Jenkins handles any Smee comands, open the "Dashboard->System Log" and search for "smee".

node-red upload attachment over http with token (multipart/form-data)

I am lost recreating curl POST request in node red.
My bank API documentation requires to form request like this:
multipart/form-data
curl -S -s --cacert GeoTrust_Primary_CA.pem -X POST -F "type=xml" -F "token=aGEMQB9Idh35fxxxxxxxxxxxxxQwyGlQ" -F "file=#C:\davka.xml" https://www.fio.cz/ib_api/rest/import/> result.xml 2>errorlog.txt type errorlog.txt
I really need just
curl -X POST -F "type=xml" -F "token=aGEMQB9Idh35fxxxxxxxxxxxxxQwyGlQ" -F "file=#C:\davka.xml" https://www.fio.cz/ib_api/rest/import/
However I am not able to pass the token to the form.
still get Required String parameter 'token' is not present
I failed with prefered http request or many node-red-contrib-send-form(...) variations.
My flow:
[{"id":"f0c84434.8907a8","type":"fileinject","z":"6012893b.689db8","name":"/share/result.xml","x":220,"y":300,"wires":[["690ae5f4.37b66c"]]},{"id":"690ae5f4.37b66c","type":"function","z":"6012893b.689db8","name":"","func":"msg.headers = {\n "content-type" : 'multipart/form-data'\n };\nlet databuffer = msg.payload;\n\nmsg.payload = {\n "KEY": {\n "value": databuffer,\n "options": {\n "filename": "data.xml",\n "type": "xml",\n "token": "aGEMQB9Idh35fxxxxxfakexxxxxxxxQwyGlQ"\n }\n }\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":220,"wires":[["6cca79ea.a45f28"]]},{"id":"6cca79ea.a45f28","type":"http request","z":"6012893b.689db8","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://www.fio.cz/ib_api/rest/import/","tls":"","persist":false,"proxy":"","authType":"","x":760,"y":220,"wires":[["8ec9dd16.83be","3f347cc6.b9a114"]]},{"id":"8ec9dd16.83be","type":"debug","z":"6012893b.689db8","name":"File has been sent","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":220,"wires":[]},{"id":"ba973765.11aa88","type":"inject","z":"6012893b.689db8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":220,"wires":[["e75f0fb7.fa71b"]]},{"id":"e75f0fb7.fa71b","type":"file in","z":"6012893b.689db8","name":"","filename":"/share/result.xml","format":"","chunk":false,"sendError":false,"encoding":"none","x":360,"y":220,"wires":[["690ae5f4.37b66c"]]},{"id":"3f347cc6.b9a114","type":"debug","z":"6012893b.689db8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"statusCode","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":280,"wires":[]}]
You should be able to do this with the core HTTP Request node. The issue is the format of the payload you are passing it.
If you change your Function node to structure the payload like this, I believe you should get further:
msg.payload = {
"file": {
"value": databuffer,
"options": {
"filename": "data.xml",
}
},
"type": "xml",
"token": "aGEMQB9Idh35fxxxxxfakexxxxxxxxQwyGlQ"
}

502 Bad Gateway nginx/1.13.12 on localhost while creating a new policy in ditto

I am new to docker, I'm using docker on windows 10 and am using Eclipse Ditto and Eclipse Mosquitto, I have to create a twin device. Before that I have to create a new policy via Postman,
While executing the policy am getting the following error:
The code to create the new policy is ass follow
curl -X put 'http://localhost:8080/api/2/policies/my.test:policy' -u 'ditto:ditto' -H 'Content-Type: application/json' -d '{
"entries": {
"owner": {
"subjects": {
"nginx:ditto": {
"type": "nginx basic auth user"
}
},
"resources": {
"thing:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
},
"policy:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
},
"message:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
}
}
}
}
}'
I'm following the procedure given in this link
is there any solution to solve this kind of problem?
Seems that the Eclipse Ditto gateway service was not running correctly.
I'm confident that you figured out to look at the output of docker-compose ps and restarted the services.

SCM-manager CLI to set branch write protection

I have downloaded SCM-manager-CLI
I need to set the branch write protection for GIT repository in SCM-manager through CLI
I have set the same through web-app
I need to do that through CLI as a part of Automation
How to do that?
Hi the cli has currently no support for properties, but you can use the rest api to set the properties:
curl -u scmadmin:scmadmin -v http://localhost:8080/scm/api/rest/repositories -XPOST -H 'Content-Type: application/json' -d '{
"name": "newrepository",
"description": "repository with branch protection",
"type": "git",
"properties": [
{ "key": "branchwp.enabled", "value": true },
{ "key": "branchwp.permissions", "value": "master,userone;develop,#devgroup;" }
],
"permissions": [
{ "name": "userone", "type": "WRITE", "groupPermission": false },
{ "name": "devgroup", "type": "WRITE", "groupPermission": true }
]
}'
The example above creates a new repository with enabled branch protection.

How to create jenkins credentials via the REST API?

I need to create a jenkins credential ( https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Plugin ) via a script. How can I do that using either the REST API or the cli ?
Note that I'm able to list the credentials using /credential-store/domain//api/json and /credential-store/domain//credential/8bd82461-e239-4db1-90bc-831ca3412e70/api/json etc.
This issue took me a while to figure, a lot of digging around, so I decided to let the solution here, if someone else needs it.
curl -X POST 'http://user:token#jenkins_server:8080/credentials/store/system/domain/_/createCredentials' \
--data-urlencode 'json={
"": "0",
"credentials": {
"scope": "GLOBAL",
"id": "identification",
"username": "manu",
"password": "bar",
"description": "linda",
"$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
}
}'
with latest jenkins you need a CRUMB to authenticate for this operation (ref https://stackoverflow.com/a/38314286)
CRUMB=$(curl -s 'http://user:token#jenkins_server:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
curl -H $CRUMB -X POST 'http://user:token#jenkins_server:8080/credentials/store/system/domain/_/createCredentials' \
--data-urlencode 'json={
"": "0",
"credentials": {
"scope": "GLOBAL",
"id": "identification",
"username": "manu",
"password": "bar",
"description": "linda",
"$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
}
}'
Otherwise you get
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /credentials/store/system/domain/_/createCredentials. Reason:
<pre> No valid crumb was included in the request</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
if you need to create credentials but with pem file path you can use this:
prerequisites: ssh-credentials plugin
CRUMB=$(curl -s 'http://{{jenkins_admin_username}}:{{jenkins_admin_password}}#localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
curl -H $CRUMB -X POST 'http://{{jenkins_admin_username}}:{{jenkins_admin_password}}#localhost:8080/credentials/store/system/domain/_/createCredentials' \
--data-urlencode 'json={
"": "0",
"credentials": {
"scope": "GLOBAL",
"id": "'{{ii.ssh_user}}'",
"username": "'{{ii.ssh_user}}'",
"password": "",
"privateKeySource": {
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$FileOnMasterPrivateKeySource",
"privateKeyFile": "'{{jenkins_home}}/{{ii.key_name}}.pem'",
},
"description": "'{{ii.ssh_user}}'",
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
}
}'
this command used in ansible but you can replace the {{variables}} with your own variables
if you need to add all the pem file content you need to change the lines to:
....
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource",
"privateKey": "{{private_key_content}}",
},
"description": "{{user}}",
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
...
Just adding my 2 cents here: if you want to create the credentials for a specific folder, then use the following:
curl -H $CRUMB -X POST 'http://user:token#jenkins_server:8080/job/MY_FOLDER_NAME/credentials/store/folder/domain/_/createCredentials' \
...
So, you need to use /job/My_Folder at the beginning of the query part and replace the /store/system with /store/folder
There is no specific API call for this, but you can do it via cli commands to the jenkins jar.
echo 'jenkins.model.Jenkins.instance.securityRealm.createAccount("username", "password")' | java -jar jenkins-cli.jar -s http://localhost/ groovy =
For granting them permissions you can create a task in Jenkins which is running every N minutes and executing a groovy script as described here:
https://wiki.jenkins-ci.org/display/JENKINS/Grant+Cancel+Permission+for+user+and+group+that+have+Build+permission
I have a groovy script that also sets user permission using Matrix-based security. The script was posted at Creating user in Jenkins via API
Unable to point to ssh keys in ~/.ssh on Jenkins host
Means this no longer works,
"privateKeySource": {
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$FileOnMasterPrivateKeySource",
"privateKeyFile": "'{{jenkins_home}}/{{ii.key_name}}.pem'",
},
📌 Here is the official documentation for managing the Jenkins Credentials via REST API
https://github.com/jenkinsci/credentials-plugin/blob/master/docs/user.adoc#creating-a-credentials
Example of adding a deploy-key credential using the username wecoyote and the password secret123 in the testing domain of the /example-folder folder.
$ cat > credential.xml <<EOF
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope>
<id>deploy-key</id>
<description>Test User</description>
<usernameSecret>false</usernameSecret>
<username>wecoyote</username>
<password>secret123</password>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
EOF
$ curl -X POST -u <username>:<password_or_token> -H content-type:application/xml -d #credential.xml \
https://jenkins.example.com/job/example-folder/credentials/store/folder/\
domain/testing/createCredentials
The expected responses are:
HTTP/200 Success, the credentials has been created.
HTTP/409 Failure, a credential with that id already exists.
HTTP/50x Could not parse the supplied domain XML body.

Resources