Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 1618184

Browse files
committed
apply changes to graphql sample README
1 parent 2869880 commit 1618184

File tree

2 files changed

+33
-29
lines changed

2 files changed

+33
-29
lines changed

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,28 @@
1515

1616
## <a name="who"></a>Audience
1717

18-
You are an Apigee Edge API proxy developer, or you would like to learn about developing APIs that run on Apigee Edge. At a minimum, we assume you're familiar with Apigee Edge and how to create simple API proxies. To learn more, we recommend this [getting-started tutorial](https://docs.apigee.com/api-platform/get-started/get-started).
18+
You are an Apigee Edge API proxy developer, or you would like to learn about
19+
developing APIs that run on Apigee Edge. At a minimum, we assume you're familiar
20+
with Apigee Edge and how to create simple API proxies. To learn more, we
21+
recommend this [getting-started
22+
tutorial](https://docs.apigee.com/api-platform/get-started/get-started).
1923

2024
> These samples were built to work with Apigee EDGE. The current version of
2125
> Apigee is known as Apigee X. Most of these samples will work with Apigee X,
2226
> but the deployment scripts will not, and the instructions for administrative
23-
> actions (eg, sign up for an account at apigee.com ) will not work either. In
27+
> actions (eg, sign up for an account at apigee.com) will not work either. In
2428
> those cases, you will need to substitute the appropriate actions relating to
2529
> Apigee X!
2630
2731
> Bear with us, please!
2832
2933
## <a name="intro"></a>Intro
3034

31-
This repository contains a collection of sample API proxies that you can deploy and run on [Apigee Edge](https://apigee.com/api-management/#/products).
35+
This repository contains a collection of sample API proxies that you can deploy and run on [Apigee Edge](https://apigee.com/api-management/#/products).
3236

3337
![alt text](./images/sample-proxies-1.png)
3438

35-
The samples provide a jump-start for developers who wish to design and create Apigee Edge API proxies. Each proxy sample includes a `deploy.sh` and `invoke.sh` script. These scripts let you easily deploy and run the proxies.
39+
The samples provide a jump-start for developers who wish to design and create Apigee Edge API proxies. Each proxy sample includes a `deploy.sh` and `invoke.sh` script. These scripts let you easily deploy and run the proxies.
3640

3741
In addition, you'll find:
3842

@@ -51,14 +55,14 @@ In addition, you'll find:
5155

5256
## <a name="using"></a>Using the sample proxies
5357

54-
Most developers begin by identifying an interesting sample based on a specific use case or need. You'll find the samples in the `./api-platform-samples/sample-proxies` folder. The Apigee doc site also has a handy [samples overview page](https://docs.apigee.com/api-platform/samples/samples-reference).
58+
Most developers begin by identifying an interesting sample based on a specific use case or need. You'll find the samples in the `./api-platform-samples/sample-proxies` folder. The Apigee doc site also has a handy [samples overview page](https://docs.apigee.com/api-platform/samples/samples-reference).
5559

5660

57-
For example, if you're interested in doing XML to JSON transformations, check out `api-platform-samples/sample-proxies/xmltojson`.
61+
For example, if you're interested in doing XML to JSON transformations, check out `api-platform-samples/sample-proxies/xmltojson`.
5862

5963
## <a name="initial"></a>Setting up
6064

61-
Set up your deployment environment.
65+
Set up your deployment environment.
6266

6367
1. Open the file `./api-platform-samples/setup/setenv.sh` in a text editor.|
6468

@@ -79,17 +83,17 @@ We make it easy:
7983
8084
1. Be sure you've updated `./api-platform-samples/setup/setenv.sh` as explained previously.
8185
82-
2. cd to one of the sample proxy folders in `./api-platform-samples/sample-proxies`.
86+
2. cd to one of the sample proxy folders in `./api-platform-samples/sample-proxies`.
8387
8488
3. Be sure you can execute the `deploy.sh` script. For example:
8589
8690
`chmod 744 deploy.sh`
8791
88-
4. Execute the deploy script.
92+
4. Execute the deploy script.
8993
9094
`./deploy.sh`
9195
92-
**Note:** If you already have the proxy deployed, the script will undeploy it first, then redeploy a new revision.
96+
**Note:** If you already have the proxy deployed, the script will undeploy it first, then redeploy a new revision.
9397
9498
Output like this means a successful deployment:
9599
@@ -109,28 +113,28 @@ We make this easy too! Each sample API proxy directory contains a script, `invok
109113
110114
1. Be sure you've updated `./api-platform-samples/setup/setenv.sh` as explained previously.
111115
112-
2. cd to one of the sample proxy folders in `./api-platform-samples/sample-proxies`.
116+
2. cd to one of the sample proxy folders in `./api-platform-samples/sample-proxies`.
113117
114118
3. Be sure you can execute the `invoke.sh` script. For example:
115119
116120
`chmod 744 invoke.sh`
117121
118122
4. Open the `invoke.sh` file and take a look at the code. Basically, the invoke scripts make `curl` requests to Apigee Edge. In some cases, `invoke.sh` performs other setup tasks, such as creating products, developer apps, and other entities on Edge.
119123
120-
**Tip:** Always open `invoke.sh` and look through it before executing it -- this will give you valuable insight into how the API proxy is called and any setup steps that are performed.
124+
**Tip:** Always open `invoke.sh` and look through it before executing it -- this will give you valuable insight into how the API proxy is called and any setup steps that are performed.
121125
122-
4. Execute the `invoke.sh` script.
126+
4. Execute the `invoke.sh` script.
123127
124128
`./invoke.sh`
125129
126130
127131
## <a name="modifying"></a>Modifying a sample proxy
128132
129-
Feel free to modify and build upon the sample proxies. You can make changes in the Edge management UI or by editing the proxy XML files locally and redeploying. Whichever approach is comfortable for you.
133+
Feel free to modify and build upon the sample proxies. You can make changes in the Edge management UI or by editing the proxy XML files locally and redeploying. Whichever approach is comfortable for you.
130134
131-
>Tip: If you use Sublime for local development, check out the [Sweetlime](https://github.com/apigee/Sweetlime) project on GitHub. Sweetlime is a Sublime plugin for developing API proxies for Apigee Edge.
135+
>Tip: If you use Sublime for local development, check out the [Sweetlime](https://github.com/apigee/Sweetlime) project on GitHub. Sweetlime is a Sublime plugin for developing API proxies for Apigee Edge.
132136
133-
Simply redeploy the proxies for changes to take effect.
137+
Simply redeploy the proxies for changes to take effect.
134138
135139
## <a name="bulk"></a>Bulk deployment
136140
@@ -164,7 +168,7 @@ API products, apps, and developers.
164168
165169
### `/setup`
166170
167-
Simple scripts to help you deploy the sample API proxies and profiles that they
171+
Simple scripts to help you deploy the sample API proxies and profiles that they
168172
rely on, including API products, developers, and apps.
169173
170174
Set you Apigee API Platform account settings in `setenv.sh` ([Register for a free Apigee account](https://docs.apigee.com/api-platform/get-started/creating-apigee-edge-account))
@@ -187,14 +191,14 @@ To deploy all samples and API products, run `deploy_all.sh`
187191
188192
## <a name="docs"></a>Apigee Edge documentation
189193
190-
The Apigee Edge docs are [here](https://docs.apigee.com).
194+
The Apigee Edge docs are [here](https://docs.apigee.com).
191195
192196
---
193197
194-
Copyright © 2018 Apigee Corporation
198+
Copyright © 2018 Apigee Corporation, 2024 Google LLC
195199
196-
Licensed under the Apache License, Version 2.0 (the "License"); you may
197-
not use this file except in compliance with the License. You may obtain
200+
Licensed under the Apache License, Version 2.0 (the "License"); you may
201+
not use this file except in compliance with the License. You may obtain
198202
a copy of the License at
199203
200204
http://www.apache.org/licenses/LICENSE-2.0

sample-proxies/graphql-sample/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Run the following command to deploy both the `graphql-config` and `graphql-proxy
4545
mvn install -Ptest -Dorg=<APIGEE_ORG> -Denv=<APIGEE_ENV> -Dusername=<APIGEE_USERNAME> -Dpassword=<APIGEE_PASSWORD>
4646
```
4747

48-
Optionally, you can deploy each of the sub-modules independently by running the same command within the specific directory.
48+
Optionally, you can deploy each of the sub-modules independently by running the same command within the specific directory.
4949

5050
e.g.
5151

@@ -76,7 +76,7 @@ The sample Apigee proxy is designed to be simple, yet concise, in order to conve
7676
2. **A KVM policy** to retrieve a scopes map
7777
3. **A JavaScript policy** to convert scopes to GraphQL entitlements
7878
4. **A JavaScript Callout** to validate and authorize the GraphQL query.
79-
79+
8080
The JavaScript Callout (in step 4), uses the [graphql-js](https://github.com/graphql/graphql-js) library to parse and syntactically validate the incoming GraphQL query. Upon validation, it proceeds to list the paths that are being accessed within the GraphQL query.
8181

8282
For example, this query:
@@ -98,7 +98,7 @@ query.resorts.name
9898
```
9999

100100
In order to authorize the query, the JavaScript callout then compares the paths that are being accessed against the paths that the client is entitled to access. For a client request to be successfully authorized, the client entitlements must contain the paths being accessed in the query.
101-
101+
102102
This is what the configuration looks like for the JavaScript callout (in step 4)
103103

104104
```
@@ -155,15 +155,15 @@ For this sample Apigee proxy, we are building the client entitlements list by us
155155
}
156156
```
157157

158-
Given the above map, if the arriving request has `reader` scope, it means that the client is entitled to execute introspection queries as well as read resorts related data.
158+
Given the above map, if the arriving request has `reader` scope, it means that the client is entitled to execute introspection queries as well as read resorts related data.
159159

160160
While it's not necessary to have a scopes-to-entitlements map, it's a practical abstraction that allows you to logically group a set of entitlements and segment access to your GraphQL schema.
161161

162162
Scopes are filtered at the Apigee API Product level. As an example, you could have a set Apigee API Products designed like this:
163163

164164
![Products](docs/images/prods.png)
165165

166-
This approach plays specially well with Apigee's consumption model with OAuth, Apps, and API Products. You could enforce that subscriptions to the `GraphQL Platinum` product require approval, where as the `GraphQL Bronze` product is open to all.
166+
This approach plays specially well with Apigee's consumption model with OAuth, Apps, and API Products. You could enforce that subscriptions to the `GraphQL Platinum` product require approval, where as the `GraphQL Bronze` product is open to all.
167167

168168
### Using GraphQL Playground to test the API Proxy
169169

@@ -177,13 +177,13 @@ To test the sample proxy, you can use the [GraphQL playground](https://legacy.gr
177177

178178
As soon as the GraphQL playground opens up, it sends a couple of introspection queries to the Apigee proxy.
179179
You can open the [Apigee Trace Tool](https://docs.apigee.com/api-platform/debug/using-trace-tool-0) and refresh the playground to see the introspection query arriving.
180-
180+
181181
![Playground200](docs/images/introspect_trace.png)
182182

183183
Note that this proxy configured such that all requests are implicitly granted the entitlements needed to introspect the schema. That's why this first request goes through successfully.
184184

185-
However, if you try to send additional queries, you will see that Apigee blocks them.
186-
185+
However, if you try to send additional queries, you will see that Apigee blocks them.
186+
187187
![Playground200](docs/images/playground_403.png)
188188

189189
You have to open the **Headers** tab in the playground, and add a **scope** header.

0 commit comments

Comments
 (0)