Skip to content

Commit efb5811

Browse files
committed
Add v1 and v2 versions of the Echo API.
1 parent b436ad5 commit efb5811

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed

endpoints/getting-started/v1.yaml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# [START swagger]
2+
swagger: "2.0"
3+
info:
4+
description: "A simple Google Cloud Endpoints API example."
5+
title: "Endpoints Example v1"
6+
version: "1.0.0"
7+
host: "echo-api.endpoints.YOUR-PROJECT-ID.cloud.goog"
8+
# [END swagger]
9+
basePath: "/v1/"
10+
consumes:
11+
- "application/json"
12+
produces:
13+
- "application/json"
14+
schemes:
15+
- "https"
16+
paths:
17+
"/echo":
18+
post:
19+
description: "Echo back a given message."
20+
operationId: "echo"
21+
produces:
22+
- "application/json"
23+
responses:
24+
200:
25+
description: "Echo"
26+
schema:
27+
$ref: "#/definitions/echoMessage"
28+
parameters:
29+
- description: "Message to echo"
30+
in: body
31+
name: message
32+
required: true
33+
schema:
34+
$ref: "#/definitions/echoMessage"
35+
security:
36+
- api_key: []
37+
"/auth/info/googlejwt":
38+
get:
39+
description: "Returns the requests' authentication information."
40+
operationId: "auth_info_google_jwt"
41+
produces:
42+
- "application/json"
43+
responses:
44+
200:
45+
description: "Authentication info."
46+
schema:
47+
$ref: "#/definitions/authInfoResponse"
48+
x-security:
49+
- google_jwt:
50+
audiences:
51+
# This must match the "aud" field in the JWT. You can add multiple
52+
# audiences to accept JWTs from multiple clients.
53+
- "echo.endpoints.sample.google.com"
54+
- gae_default_service_account:
55+
audiences:
56+
# This must match the "aud" field in the JWT. You can add multiple
57+
# audiences to accept JWTs from multiple clients.
58+
- "echo.endpoints.sample.google.com"
59+
- google_service_account:
60+
audiences:
61+
# This must match the "aud" field in the JWT. You can add multiple
62+
# audiences to accept JWTs from multiple clients.
63+
- "echo.endpoints.sample.google.com"
64+
"/auth/info/googleidtoken":
65+
get:
66+
description: "Returns the requests' authentication information."
67+
operationId: "authInfoGoogleIdToken"
68+
produces:
69+
- "application/json"
70+
responses:
71+
200:
72+
description: "Authentication info."
73+
schema:
74+
$ref: "#/definitions/authInfoResponse"
75+
x-security:
76+
- google_id_token:
77+
audiences:
78+
# Your OAuth2 client's Client ID must be added here. You can add
79+
# multiple client IDs to accept tokens from multiple clients.
80+
- "YOUR-CLIENT-ID"
81+
82+
"/auth/info/firebase":
83+
get:
84+
description: "Returns the requests' authentication information."
85+
operationId: "authInfoFirebase"
86+
produces:
87+
- "application/json"
88+
responses:
89+
200:
90+
description: "Authentication info."
91+
schema:
92+
$ref: "#/definitions/authInfoResponse"
93+
x-security:
94+
- firebase:
95+
audiences:
96+
- "YOUR-PROJECT-ID"
97+
98+
definitions:
99+
echoMessage:
100+
properties:
101+
message:
102+
type: "string"
103+
authInfoResponse:
104+
properties:
105+
id:
106+
type: "string"
107+
email:
108+
type: "string"
109+
110+
securityDefinitions:
111+
# This section configures basic authentication with an API key.
112+
api_key:
113+
type: "apiKey"
114+
name: "key"
115+
in: "query"
116+
# This section configures authentication using Google API Service Accounts
117+
# to sign a json web token. This is mostly used for server-to-server
118+
# communication.
119+
google_jwt:
120+
authorizationUrl: ""
121+
flow: "implicit"
122+
type: "oauth2"
123+
# This must match the 'iss' field in the JWT.
124+
x-google-issuer: "jwt-client.endpoints.sample.google.com"
125+
# Update this with your service account's email address.
126+
x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL"
127+
# This section configures authentication using Google App Engine default
128+
# service account to sign a json web token. This is mostly used for
129+
# server-to-server communication.
130+
gae_default_service_account:
131+
authorizationUrl: ""
132+
flow: "implicit"
133+
type: "oauth2"
134+
# Replace YOUR-CLIENT-PROJECT-ID with your client project ID.
135+
x-google-issuer: "[email protected]"
136+
# Replace YOUR-CLIENT-PROJECT-ID with your client project ID.
137+
x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/[email protected]"
138+
# This section configures authentication using a service account
139+
# to sign a json web token. This is mostly used for server-to-server
140+
# communication.
141+
google_service_account:
142+
authorizationUrl: ""
143+
flow: "implicit"
144+
type: "oauth2"
145+
# Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email.
146+
x-issuer: "YOUR-SERVICE-ACCOUNT-EMAIL"
147+
# Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email.
148+
x-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/YOUR-SERVICE-ACCOUNT-EMAIL"
149+
# This section configures authentication using Google OAuth2 ID Tokens.
150+
# ID Tokens can be obtained using OAuth2 clients, and can be used to access
151+
# your API on behalf of a particular user.
152+
google_id_token:
153+
authorizationUrl: ""
154+
flow: "implicit"
155+
type: "oauth2"
156+
x-google-issuer: "accounts.google.com"
157+
x-google-jwks_uri: "https://www.googleapis.com/oauth2/v1/certs"
158+
# This section configures authentication using Firebase Auth.
159+
firebase:
160+
authorizationUrl: ""
161+
flow: "implicit"
162+
type: "oauth2"
163+
x-google-issuer: "https://securetoken.google.com/YOUR-PROJECT-ID"
164+
x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/[email protected]"

endpoints/getting-started/v2.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# [START swagger]
2+
swagger: "2.0"
3+
info:
4+
description: "Version 2 of a simple Google Cloud Endpoints API example."
5+
title: "Endpoints Example v2"
6+
version: "2.0.0"
7+
host: "echo-api.endpoints.YOUR-PROJECT-ID.cloud.goog"
8+
# [END swagger]
9+
basePath: "/v2"
10+
consumes:
11+
- "application/json"
12+
produces:
13+
- "application/json"
14+
schemes:
15+
- "https"
16+
paths:
17+
"/echo":
18+
post:
19+
description: "Echo back a given message."
20+
operationId: "echo"
21+
produces:
22+
- "application/json"
23+
responses:
24+
200:
25+
description: "Echo"
26+
schema:
27+
$ref: "#/definitions/echoMessage"
28+
parameters:
29+
- description: "Message to echo"
30+
in: body
31+
name: message
32+
required: true
33+
schema:
34+
$ref: "#/definitions/echoMessage"
35+
security:
36+
- api_key: []
37+
38+
definitions:
39+
echoMessage:
40+
properties:
41+
newMessage:
42+
type: "string"
43+
44+
securityDefinitions:
45+
# This section configures basic authentication with an API key.
46+
api_key:
47+
type: "apiKey"
48+
name: "key"
49+
in: "query"

0 commit comments

Comments
 (0)