I have create a service, a route, an auth, a consumer, a username and a password in the kong admin UI through curl command. Below there is the command that I have used and it's showing in the kong admin UI.
I have installed Kong as docker container with image version is kong/kong-gateway:2.8.1.2-alpine
curl -X POST http://x.x.x.x:8001/services \
--data name=admin-api \
--data host=x.x.x.x \
--data port=8001
curl -X POST http://x.x.x.x:8001/services/admin-api/routes \
--data paths\[\]=/admin-api
curl -X POST http://x.x.x.x:8001/services/admin-api/plugins \
--data "name=basic-auth" \
--data "config.hide_credentials=true"
curl -d "username=first-consumer&custom_id=1" http://x.x.x.x:8001/consumers/
curl -X POST http://x.x.x.x:8001/consumers/first-consumer/basic-auth \
--data "username=first-consumer" \
--data "password=my-password"
curl -s -X GET \
--url http://x.x.x.x:8000/admin-api \
--header 'Authorization: Basic Zmlyc3QtY29uc3VtZXI6bXktcGFzc3dvcmQK'
Below command I get 200 ok response
curl -i -X GET --url http://20.69.125.27:8000 --header "Host: petstore.swagger.io" --header "apikey: apisec"
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 734
Connection: keep-alive
Date: Wed, 10 Aug 2022 11:52:06 GMT
Server: nginx
Last-Modified: Tue, 02 Aug 2022 12:23:11 GMT
Vary: Accept-Encoding
ETag: "62e9172f-2de"
Expires: Thu, 11 Aug 2022 11:52:06 GMT
Cache-Control: max-age=86400
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
Accept-Ranges: bytes
X-Kong-Upstream-Latency: 322
X-Kong-Proxy-Latency: 52
Via: kong/2.8.1.2-enterprise-edition
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
</body>
</html>
im getting above output in html but i want in json format
How to get fetch on https://petstore.swagger.io/v2/swagger.json through curl as json file from kong setup ?