Viewing Service Details Using Curl with SDDC Manager
In this procedure, we will use the /v1/vcf-services API to retrieve service details for a SDDC Manager instance.
SDDC Manager APIs Used
- POST /v1/tokens
- GET /v1/vcf-services
Obtaining Service Details for all Services from SDDC Manager
Procedure
- Connect to the SDDC Manager appliance over SSH.
- Replace the values in the sample code with values for your SDDC Manager instance and run the commands SSH session.
1sddcManagerFqdn=$'sfo-vcf01.sfo.rainpole.io'
2sddcManagerUser=$'admin@local'
3sddcManagerPass=$'VMw@re1!VMw@re1!'
- Authenticate to SDDC Manager and obtain a token by running the following command:
1TOKEN=$(curl -k -X POST https://$sddcManagerFqdn/v1/tokens -H 'Content-Type:application/json' -d '{"username": "'$sddcManagerUser'","password": "'$sddcManagerPass'"}' | jq -r '.accessToken')
- Retrieve all service details from the SDDC Manager instance by running the following command:
1curl -k -X GET "https://$sddcManagerFqdn/v1/vcf-services" -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" | jq '.elements[]'
Obtaining Service Details for a Specific Service from SDDC Manager
Procedure
- Connect to the SDDC Manager appliance over SSH.
- Replace the values in the sample code with values for your SDDC Manager instance and run the commands SSH session.
1sddcManagerFqdn=$'sfo-vcf01.sfo.rainpole.io'
2sddcManagerUser=$'admin@local'
3sddcManagerPass=$'VMw@re1!VMw@re1!'
4sddcManagerService=$'LCM'
NOTE Services available in SDDC Manager include COMMON_SERVICES, OPERATIONS_MANAGER, SDDC_MANAGER_UI, DOMAIN_MANAGER, and LCM.
- Authenticate to SDDC Manager and obtain a token by running the following command:
1TOKEN=$(curl -k -X POST https://$sddcManagerFqdn/v1/tokens -H 'Content-Type:application/json' -d '{"username": "'$sddcManagerUser'","password": "'$sddcManagerPass'"}' | jq -r '.accessToken')
- Retrieve service details for a specific service from the SDDC Manager instance by running the following command:
1curl -k -X GET "https://$sddcManagerFqdn/v1/vcf-services" -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" | jq '.elements[] | select(.name == "'$sddcManagerService'")'