- CheckMates
- :
- Products
- :
- Developers
- :
- DevSecOps
- :
- Re: How to create a new ServiceAccount via API?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to create a new ServiceAccount via API?
This is really confusing! https://api-v2-docs.dome9.com/?shell#serviceaccount_postserviceaccount
According to the link I should be able to create a new service account via the API
curl -X POST https://api.dome9.com/v2/service-account \ --basic -u <key-id>:<key-secret> \ -H 'Content-Type: application/json' \ -H 'Accept: application/json'
But that block doesn't make any sense? Does it return a generic ID which I then use to update with another call? If I do post to it I get an error:
HTTP Error 411. The request must be chunked or have a content length.
Looking for some guidance, I'd like to be able to create a new service account to onboard Kubernetes clusters, 1 account per cluster. Thanks!!
-David
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
My API guru says:
The name and role-ids for the service-account must be provided in the request as described in the body parameter section of the documentation.
With curl:
curl
'https://api.dome9.com/v2/service-account' \
--basic -u <key-id>:<key-secret> \
-H
'Content-Type: application/json' \
-H
'Accept: application/json'
--data-raw
'{"name":"<SERVICE_ACCOUNT_NAME>","roleIds":[<LIST,OF,ROLE,IDS>]}'
The response will contain all relevant information about the newly created service-account:
{"name":
"SERVICE_ACCOUNT_NAME",
"id":
"b72019f5-e5af-4ad5-a6a3-27c6a89079cd",
"apiKeyId":
"6b83cacf-d2dd-4f55-8811-c75ec879791e",
"apiKeySecret":
"26ycmazsqblt1owufed7kxhg",
"roleIds": [
LIST,
OF,
ROLE,
IDS
]
}
To get a list of all roles and their ids:
curl
'https://api.dome9.com/v2/role' \
--basic -u <key-id>:<key-secret> \
-H
'Content-Type: application/json' \
-H
'Accept: application/json'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is documentation in the link out of date? Is there a better resource? It looks completely wrong! I'll see if I can create a service request on that product/capability.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
My API guru says:
The name and role-ids for the service-account must be provided in the request as described in the body parameter section of the documentation.
With curl:
curl
'https://api.dome9.com/v2/service-account' \
--basic -u <key-id>:<key-secret> \
-H
'Content-Type: application/json' \
-H
'Accept: application/json'
--data-raw
'{"name":"<SERVICE_ACCOUNT_NAME>","roleIds":[<LIST,OF,ROLE,IDS>]}'
The response will contain all relevant information about the newly created service-account:
{"name":
"SERVICE_ACCOUNT_NAME",
"id":
"b72019f5-e5af-4ad5-a6a3-27c6a89079cd",
"apiKeyId":
"6b83cacf-d2dd-4f55-8811-c75ec879791e",
"apiKeySecret":
"26ycmazsqblt1owufed7kxhg",
"roleIds": [
LIST,
OF,
ROLE,
IDS
]
}
To get a list of all roles and their ids:
curl
'https://api.dome9.com/v2/role' \
--basic -u <key-id>:<key-secret> \
-H
'Content-Type: application/json' \
-H
'Accept: application/json'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Mark_Halsall! I confirmed the docs were updated. This should make things much easier from now on!
