You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs/api-platform/fundamentals/build-simple-api-proxy). info

> [!NOTE]
> **NOTE:** Apigee provides a set of samples on GitHub that you can download and run locally.
>
> For a list of samples, see [Samples
> list](https://docs.apigee.com/api-platform/samples/samples-reference).
>
> The [setup README](https://github.com/apigee/api-platform-samples/blob/master/setup/README.md)
> in the samples also contains the information in this topic.

## Prerequisites

You'll need an account on [http://enterprise.apigee.com](https://enterprise.apigee.com). You can sign up
for a trial account at
[http://accounts.apigee.com/accounts/sign_up](https://accounts.apigee.com/accounts/sign_up?callback=https://enterprise.apigee.com).

> [!NOTE]
> **NOTE:** For more information on creating accounts, see [Creating an Apigee Edge
> account](https://docs.apigee.com/api-platform/get-started/creating-apigee-edge-account).

To use samples, you should also have the following:

| Tool | Description |
|---|---|
| Git | The samples are located on GitHub. If you do not have Git installed, please refer to [GitHub's git setup instructions](https://help.github.com/articles/set-up-git). If you don't want to install Git, you can browse the files and download a ZIP from <https://github.com/apigee/api-platform-samples>. |
| Python | Python is required to run the Apigee deploy tool. Python is present in most Linux environments, on a Mac with XCode installed, on a Windows machine with [Cygwin](https://www.cygwin.com/) installed, and in many other places. To obtain Python, please refer to the [Python download page](https://www.python.org/downloads/). |
| `curl` | The sample setup scripts also use [`curl`](https://curl.haxx.se/). Make sure `curl` is installed and available on your path (run the `which curl` command to see if it's available on your system). |
| `dos2unix` | If you're running Cygwin on Windows, you may also need the `dos2unix` utility. (The Cygwin installer lets you install the utility.) |

## Download the samples

To obtain the sample files, use `git clone` as the following example shows:

```
git clone https://github.com/apigee/api-platform-samples.git
```

## Import and deploy the sample API
proxies

Import and deploy the samples from the command line:

1. After you download the samples, go to the `/setup` directory, as the following example shows:

   ```
   cd setup
   ```
2. In the `/setup` directory, locate the file `setenv.sh`.
3. Edit this file to set your organization, the email address associated with your username, and the environment (prod or test) where you want to deploy the API proxies.
4. After you edit `setenv.sh`, execute the following:

   ```
   sh deploy_all.sh
   ```

   This script deploys all API proxy samples to your organization. (The process takes 3-4
   minutes.) Follow prompts to deploy API products, developers, and apps (which are used for
   OAuth).
5. After the deploy script completes, navigate to the sample-proxies directory. In the directory `sample-proxies`, you will find one directory per sample proxy. In each directory is a README.md file with information about running the sample, and two scripts that help you as you make small changes to the samples, deploy, and then invoke the sample to see what effect you change had:
   - `invoke.sh`: Execute this script to invoke the deployed version of the API proxy.
   - `deploy.sh`: Execute this script to deploy the API proxy after you make any changes.

## Invoke the sample API proxies

Each sample proxy has an associated shell script that can be used to invoke the API proxy
after you deploy it.

From the `/sample-proxies/proxy_name` directory, execute the
following:

```
sh invoke.sh
```

This invokes the proxy that is running in the test environment in your organization.

## Troubleshooting

For troubleshooting information, see the following:

- [Troubleshooting introduction](https://docs.apigee.com/api-platform/troubleshoot/troubleshooting-introduction)
- [Windows/Cygwin Troubleshooting](https://github.com/apigee/api-platform-samples/blob/master/setup/README.md#windowscygwin-troubleshooting)

## Modify and reuse the sample API proxies

Typical usage of the sample proxies is to modify, deploy, and invoke. This enables you to make
small modifications, and then to see what effect they have on the response message.

To modify a sample API proxy to point at a different backend service, modify the
XML configuration file in the following location:

```
/apiproxy/targets/target_name.xml
```

For example, to point the API key sample at your own backend service, locate this file:

```
/apikey/apiproxy/targets/default.xml
```

If the default configuration points to `http://mocktarget.apigee.net`, such as:

```
<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <!-- This is where we define the target. For this sample we just use a simple URL. -->
    <URL>http://mocktarget.apigee.net</URL>
  </HTTPTargetConnection>
</TargetEndpoint>
```

and your backend service is available at `http://api.myproject.com/`, then you
modify the configuration to look like the following:

```
<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <!-- This is where we define the target. For this sample we just use a simple URL. -->
    <URL>http://api.myproject.com/</URL>
  </HTTPTargetConnection>
</TargetEndpoint>
```

After you have saved your changes, deploy the API proxy as the following example shows:

```
sh deploy.sh
```

The other API proxies can be modified the same way in order to use the API proxy functionality
against your existing target services. In some cases, however, API proxy behavior is dependent on
specific message formats, so the proxies might need additional configuration changes.