티스토리 뷰
Create an API from the Tyk REST API
Tyk Cloud를 사용하면 Tyk REST API 를 사용하여 API를 만들 수 있다.
대신 가입할때 등록했던 조직의 API키가 필요하며 LIVE로 만들려면 하나의 명령이 필요하다.
#1. Tyk Cloud 용 API 키 가져오기
Users 선택 후 EDIT 클릭한다.
하단에 보면 API키가 첫번째 항목이다.
#2. API 만들기
Tyk는 정의서(원문에는 Definitions)에서 파일 / 객체를 통해서 API를 처리한다.
정의서는 /etc/tyk/apps 디렉토리나 MongoDB 컬렉션에 있다.
API 추가는 관리자의 엔드포인트 정의서의 "Authorization" 헤더를 수정한다.
curl -H "Authorization: 1238b7e0e2ff4c2957321724409ee2eb" \ -s \ -H "Content-Type: application/json" \ -X POST \ -d '{ "api_definition": { "name": "Test API", "slug": "test-api", "auth": { "auth_header_name": "Authorization" }, "definition": { "location": "header", "key": "x-api-version" }, "version_data": { "not_versioned": true, "versions": { "Default": { "name": "Default", "use_extended_paths": true } } }, "proxy": { "listen_path": "/test-api/", "target_url": "http://httpbin.org/", "strip_listen_path": true }, "active": true } }' https://admin.cloud.tyk.io/api/apis/ | python -mjson.tool
명령이 성공하면 다음과 같이 표시된다.
{ "Status": "OK", "Message": "API created", "Meta": "59c8cdfd4913111112b0b5ec" }
'■ 데브옵스 ■ > Tyk' 카테고리의 다른 글
Create an API Token from the Tyk REST API : Tyk REST API에서 API 토큰 생성 (0) | 2018.03.09 |
---|---|
Create an API Token from the Dashboard : 대시보드에서 API 토큰 생성 (0) | 2018.03.09 |
Create an API from the Dashboard : 대시보드에서 API 만들기 (0) | 2018.03.09 |
Create an Account And Dashboard Login : 계정 생성및 대시보드 로그인 (0) | 2018.03.09 |
With Tyk Cloud : 타이크 클라우드 (0) | 2018.03.09 |