I try to generate an access token for an Artifactory user using this command:
curl -u<user>:<password> -XPOST https://<server_url>/artifactory/api/security/token
And I get following error:
"errors" : [ {
"status" : 500,
"message" : "The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded"
} ]
}
I tried as password the login password of the user, the API key and the Encrypted Password. Each time I got the same result.
Any ideas what can be wrong?
Here's the documentation. You're missing two mandatory parameters:
i.e. you need:
curl -u<user>:<password> -XPOST https://<server_url>/artifactory/api/security/token
-d "username=<user>" -d "scope=member-of-groups:readers"
The specific error is because you're not passing any parameters at all. curl is therefore not generating a request body and hence it is not including a 'Content-Type' header in the request, and the server is reporting that it only knows how to pass arguments to the REST API from a POSTed form.