Multi-line inputs are, indeed, tricky. We have an issue open to add some shortcut options for credentials in v2, but even then you will likely prefer to get keys from files.
Also consider running the example with verbosity on, -v, to see the request data, which might get the ball rolling for whatever else you’re attempting.
Your example helped me figure out what was happening.
My api user (I use token authentication) didn’t have enough privileges to create credentials. I had to set that account as a system administrator in order to do so.
I think this is a limitation, given that I don’t want to give sysadmin privileges to that specific user, to limit it the exposure of certain playbooks, but I do want him to be able to create new credentials.
Is this behaviour intended? or probably a new issue?
What you’re describing sounds like its related to how we assign ownership to credentials. Here’s what we have in the current system… in the request body you must provide either:
user
team
organization
If you provide organization, then you need to be admin of that organization, and then, that credential will have some limited sharing rules with other people in the org (only admins I believe). But if you provide user, that makes it a “private” credential. In practice, the user should be yourself, and you will get admin role to the credential you created. AFAIK, every user in the system should be able to create a private credential.