I found this to create credentials in Jenkins using a REST API call, how to update the credentials with a given id using the REST API calls?
curl -X POST 'http://jenkins:8080/credentials/store/system/domain/_/createCredentials' --data-urlencode 'json={
"": "0",
"credentials": {
"scope": "GLOBAL",
"id": "apicredentials",
"username": "apicredentials",
"password": "P@$$W0rd",
"description": "apicredentials",
"stapler-class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
}
}'