@@ -91,4 +91,49 @@ To run the tests, you just need to run `docker-compose -f docker-compose.test.ym
9191
9292Check the logs for error.
9393
94- ### How to access surface, climsoft or mch API
94+ ### How to access surface, climsoft, pygeoapi or mch API
95+
96+ OpenCDMS API server is a FastAPI application. surface, climsoft, pygeoapi, mch servers are
97+ mounted to this FastAPI application. When mounting these child applications, we also have
98+ enforced an Auth Middleware. So, if you want to access the endpoints on these child applications,
99+ you have to make authenticated request.
100+
101+ To get an access token using default username and password:
102+
103+ ``` bash
104+ $ curl -X ' POST' \
105+ ' http://localhost:5070/auth' \
106+ -H ' accept: application/json' \
107+ -H ' Content-Type: application/json' \
108+ -d ' {
109+ "username": "admin",
110+ "password": "password123"
111+ }'
112+ ```
113+
114+ Say, it returns
115+
116+ ``` bash
117+ {
118+ " access_token" : " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTY0MzgzMDUzMiwidG9rZW5fdHlwZSI6ImFjY2VzcyIsImp0aSI6ImEzM2Q4OWMyLTNlNmEtNDJlYS04MGZjLWViZjEzNTcyZjU5MSIsInVzZXJfaWQiOjF9.dp_wPSDZwL4HAN8JWCWyGRlL0s8gRvWKASUeDPQQygY"
119+ }
120+ ```
121+
122+ Now you can make request to protected endpoints using this access token as ` Bearer ` token.
123+
124+ Here is an example:
125+
126+ ``` bash
127+ $ curl -X ' GET' \
128+ ' http://localhost:5070/climsoft/v1/acquisition-types/?limit=25&offset=0' \
129+ -H ' accept: application/json' \
130+ -H ' Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTY0MzgzMDUzMiwidG9rZW5fdHlwZSI6ImFjY2VzcyIsImp0aSI6ImEzM2Q4OWMyLTNlNmEtNDJlYS04MGZjLWViZjEzNTcyZjU5MSIsInVzZXJfaWQiOjF9.dp_wPSDZwL4HAN8JWCWyGRlL0s8gRvWKASUeDPQQygY'
131+ ```
132+
133+ which will return something like this:
134+
135+ ``` bash
136+ {" message" :" Successfully fetched acquisition types." ," status" :" success" ," result" :[]}
137+ ```
138+
139+ You can use Postman to make this requests easily.
0 commit comments