MongoDB Atlas API: Create New CustomRole With Curl and Payload

I am having issues creating customRoles in MongoDB Atlas using API and curl.

Resource - MongoDB Atlas Administration API

I can display customRoles created in MongoDB Atlas UI like this:

curl --user "{username}:{password}"  --digest --header "Accept: application/vnd.atlas.2023-02-01+json" https://cloud.mongodb.com/api/atlas/v2/groups/{groupID}/customDBRoles/roles

I am able to get

[{"actions":[{"action":"COLL_MOD","resources":[{"collection":"","db":"example"}]}],"inheritedRoles":[],"roleName":"callmodRole"},{"actions":[{"action":"COLL_MOD","resources":[{"collection":"","db":"example-logs"}]}],"inheritedRoles":[],"roleName":"customcallmodRole"}]

I am also able to delete

curl -v -X DELETE https://cloud.mongodb.com/api/atlas/v2/groups/{groupID}/customDBRoles/roles/customremoveRole --user "{username}:{password}"  --digest --header "Accept: application/vnd.atlas.2023-02-01+json"

The issue is I am unable to create customRoles in MongoDB Atlas with this curl command.

>curl -v -X POST https://cloud.mongodb.com/api/atlas/v2/groups/{groupID/customDBRoles/roles --user "{username}:{password}"  --digest --header "Accept: application/vnd.atlas.2023-02-01+json" -d {"actions":[{"action":"REMOVE","resources":[{"collection":"","db":"ambience"}]}],"inheritedRoles":[],"roleName":"customremoveRole"}

I got this error

“error” : 415,
“reason” : “Unsupported Media Type”

If I change the --header to "Content-Type: application/vnd.atlas.2023-02-01+json" or "Content-Type: application/json"

I’ll receive

{“detail”:“Invalid accept header or version date.”,“error”:406,“errorCode”:“INVALID_VERSION_DATE”,“parameters”:,“reason”:“Not Acceptable”}* Connection #0 to host cloud.mongodb.com left intact

Please do share where did I go wrong?

Updated.

I recently tried this but comes back with a different error

curl -v -X POST https://cloud.mongodb.com/api/atlas/v2/groups/{groupID}/customDBRoles/roles --user "{username}:{password}" --digest --header "Accept: application/vnd.atlas.2023-02-01+json" --header "Content-Type: application/vnd.atlas.2023-02-01+json" --data '{"actions":[{"action":"REMOVE","resources":[{"collection":"","db":"ambience"}]}],"inheritedRoles":[],"roleName":"customremoveRole"}'

The error is:

{“detail”:“Received JSON is malformed.”,“error”:400,“errorCode”:“MALFORMED_JSON”,“parameters”:,“reason”:“Bad Request”}* Connection #0 to host cloud.mongodb.com left intact

Please help?