본문 바로가기

Management

[Automation] How to login vRealize Automation API Server

# Prerequisites

먼저, vRealize Automation에 연결 가능한 PC 또는 서버에 Postman을 설치해야 합니다.

https://www.postman.com/downloads/

 

Download Postman | Get Started for Free

Try Postman for free! Join 20 million developers who rely on Postman, the collaboration platform for API development. Create better APIs—faster.

www.postman.com

 

1. 먼저 Refresh Token을 획득합니다.

URL : https://<vra 주소>/csp/gateway/am/api/login?access_token
Method : POST
Headers
Key : Content-Type, Value : application/json
Body
{
    "username": "
관리자계정 입력",
    "password": "계정 암호 입력",
    "domain": "System Domain"
}

Headers 화면

Body 화면

결과 화면

 

2. 1번에서 획득한 Refresh Token을 이용하여, Token을 획득합니다.

URL : https://<vra 주소>/iaas/api/login?
Method : POST
Headers
Key : Content-Type, Value : application/json
Body
{
    "refreshToken": "7Df49tZeKiqbpP0dtzVjPFQ9r4WdFxG0" ## 7Df49tZeKiqbpP0dtzVjPFQ9r4WdFxG0
이전 단계에서 획득한
}

Headers 화면

Body 화면

결과 화면

 

3. 획득한 Token으로 API 호출 테스트

URL : https://vra01.contoso.com/deployment/api/deployments/6b5a5817-88f7-41f8-be5f-8298594c27da

Method : GET

Headers

Key : Content-Type, Value : application/json

Key : Authorization, Value : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEx... ## Token 값 입력

 

결과

{
    "id": "6b5a5817-88f7-41f8-be5f-8298594c27da",
    "name": "Deployment-95c92006-8118-40c7-a667-920ec6033eee",
    "orgId": "058a459c-2b9f-415a-8b0c-afb9a4a22d0b",
    "createdAt": "2022-09-30T08:49:07.740509Z",
    "createdBy": "configadmin",
    "ownedBy": "configadmin",
    "lastUpdatedAt": "2022-09-30T08:51:07.372173Z",
    "lastUpdatedBy": "configadmin",
    "inputs": {},
    "projectId": "6035a21b-eef5-4f60-9537-c8d39f0fe1fc",
    "status": "CREATE_SUCCESSFUL"
}

Headers 화면

결과 화면

 

vRealize Automation에서 제공하는 API는 Swagger를 통해 확인할 수 있습니다.

Swagger UI에 접속하기 위한 주소는 다음과 같습니다.

https://vra01.contoso.com/automation-ui/api-docs/