Skip to content

Commit 8d1b73e

Browse files
committed
Doc update for git proxy type
1 parent f7710ec commit 8d1b73e

File tree

4 files changed

+166
-8
lines changed

4 files changed

+166
-8
lines changed

en/docs/develop-components/develop-an-api-proxy.md renamed to en/docs/develop-components/develop-proxy/develop-an-api-proxy.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Develop an API Proxy
1+
# Develop an API Proxy from an OAS
22

33
An API proxy acts as an intermediary between an existing API and Choreo, intercepting all requests made to the API. It also functions as a managed API, allowing you to apply essential API management features such as security policies and rate limiting.
44

@@ -71,7 +71,7 @@ Now you are ready to test the API proxy.
7171

7272
## Step 4: Test the API proxy
7373

74-
Choreo allows you to test your API proxy using either the [integrated OpenAPI Console](../testing/test-rest-endpoints-via-the-openapi-console.md) or [cURL](../testing/test-apis-with-curl.md). In this guide, you will use the OpenAPI Console.
74+
Choreo allows you to test your API proxy using either the [integrated OpenAPI Console](../../testing/test-rest-endpoints-via-the-openapi-console.md) or [cURL](../testing/test-apis-with-curl.md). In this guide, you will use the OpenAPI Console.
7575

7676
!!! tip
7777
Choreo enables OAuth 2.0 to secure APIs by default. Therefore, you need an access token to invoke an API.
@@ -90,7 +90,7 @@ Choreo allows you to test your API proxy using either the [integrated OpenAPI Co
9090
3. Expand the `GET /department/{departmentId}` resource and click **Try it Out**.
9191
4. Enter `1` as the **departmentId** and click **Execute**. You will see a response similar to the following:
9292

93-
![API proxy response](../assets/img/develop-components/develop-a-rest-api-proxy/rest-api-proxy-response.png){.cInlineImage-full}
93+
![API proxy response](../../assets/img/develop-components/develop-a-rest-api-proxy/rest-api-proxy-response.png){.cInlineImage-full}
9494

9595
This indicates that your API proxy is working as expected.
9696

@@ -133,8 +133,8 @@ To generate credentials for the published API and invoke it via the Choreo Devel
133133
4. Expand the `GET /department/{departmentId}` resource and click **Try it out**.
134134
5. Enter `1` as the **departmentId** and click **Execute**. You will see a response similar to the following:
135135

136-
![Try out response](../assets/img/develop-components/develop-a-rest-api-proxy/try-out-response.png){.cInlineImage-full}
136+
![Try out response](../../assets/img/develop-components/develop-a-rest-api-proxy/try-out-response.png){.cInlineImage-full}
137137

138138
Now, you have gained hands-on experience creating, deploying, testing, and publishing an API proxy using Choreo API Manager.
139139

140-
To learn more about the API management capabilities supported by Choreo API Manager, see [API Management](../api-management/lifecycle-management.md).
140+
To learn more about the API management capabilities supported by Choreo API Manager, see [API Management](../../api-management/lifecycle-management.md).
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Develop an API Proxy from a GH source
2+
3+
An API proxy acts as an intermediary between an existing API and Choreo, intercepting all requests made to the API. It also functions as a managed API, allowing you to apply essential API management features such as security policies and rate limiting.
4+
5+
In this guide, you will:
6+
7+
- Create an API proxy component to expose an existing API.
8+
- Deploy the API proxy.
9+
- Test the API proxy to verify its functionality.
10+
- Manage the API.
11+
- Consume the API.
12+
13+
## Prerequisites
14+
15+
- If you're signing in to the Choreo Console for the first time, create an organization:
16+
1. Go to [https://console.choreo.dev/](https://console.choreo.dev/) and sign in using your preferred method.
17+
2. Enter a unique organization name. For example, `Stark Industries`.
18+
3. Read and accept the privacy policy and terms of use.
19+
4. Click **Create**.
20+
21+
This creates the organization and opens the **Project Home** page of the default project created for you.
22+
23+
## Step 1: Create an API proxy
24+
25+
To create an API proxy, you can either choose from a github repository, upload an OpenAPI specification or provide an OpenAPI specification URL. In this guide, you will specify a URL to an OpenAPI definition of a sample API.
26+
27+
1. Go to [https://console.choreo.dev/](https://console.choreo.dev/) and sign in. This opens the project home page.
28+
2. If you already have one or more components in your project, click **+ Create**. Otherwise, proceed to the next step.
29+
3. Click the **API Proxy** card. This opens the **Create an API Proxy** pane.
30+
4. You will see the three options to create a proxy component and here we select github option (selected by default).
31+
5. Specify the following values as component details:
32+
33+
!!! info
34+
The **Component Name** field must be unique and cannot be changed after creation.System will generate a unique name for you. But you are free to change the generated name.
35+
**Component Display Name** is a required field.
36+
37+
| **Field** | **Value** |
38+
|-----------------|--------------------------------------------|
39+
| **Component Display Name**| `Pet Service` |
40+
| **Component Name** | `pet-service` |
41+
| **Description** | `This is a sample pet store` |
42+
43+
6. Go to the **GitHub** tab.
44+
- Click **Authorize with GitHub** to connect your GitHub account. If you haven’t connected your GitHub repository to Choreo, enter your GitHub credentials and select the repository you forked in the prerequisites section to install the [Choreo GitHub App](https://github.com/marketplace/choreo-apps).
45+
46+
!!! note
47+
The **Choreo GitHub App** requires the following permissions:
48+
- Read and write access to code and pull requests.
49+
- Read access to issues and metadata.
50+
51+
You can [revoke access](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/reviewing-your-authorized-integrations#reviewing-your-authorized-github-apps) if needed. Write access is only used for sending pull requests; Choreo will not push changes directly to your repository.
52+
53+
6. Enter the following repository details:
54+
55+
| **Field** | **Value** |
56+
|------------------------|--------------------|
57+
| **Organization** | Your GitHub account|
58+
| **Repository** | choreo-samples |
59+
| **Branch** | **`main`** |
60+
| **API Directory** | /choreo-samples/proxy-from-gh/pet-service |
61+
62+
7. Specify the following values as API proxy details:
63+
64+
!!! info
65+
The **Context** field must be unique and cannot be changed after creation.**Version** and **Target** are mandatory fields. **Target** can be changed at any time after the creation.
66+
67+
| **Field** | **Value** |
68+
|-----------------|--------------------------------------------|
69+
| **Context** | `pet/v1` |
70+
| **Version** | `V1.0` |
71+
| **Target** | `https://samples.choreoapps.dev/company/pet-service`|
72+
73+
6. Click **Create**. This creates the API proxy component and takes you to the **Overview** page.
74+
75+
## Step 2: Define resources for the API proxy
76+
77+
!!! note
78+
When you creating an API proxy by **pointing a github repository** , the GH source consider as the **single source of truth**. So , the only way is to change API resources like resource addition, deletion of modifications should be done trought the GH source.
79+
80+
## Step 3: Deploy the API proxy
81+
82+
1. In the left navigation menu, click **Deploy**.
83+
2. In the **Build Area** card, click **Configure & Deploy**. This opens the **Configure & Deploy** pane.
84+
3. Select **External** as the API access mode and click **Deploy**. The **Development** card indicates the **Deployment Status** as **Active** when the API proxy is successfully deployed.
85+
86+
Now you are ready to test the API proxy.
87+
88+
## Step 4: Test the API proxy
89+
90+
Choreo allows you to test your API proxy using either the [integrated OpenAPI Console](../../testing/test-rest-endpoints-via-the-openapi-console.md) or [cURL](../../testing/test-apis-with-curl.md). In this guide, you will use the OpenAPI Console.
91+
92+
!!! tip
93+
Choreo enables OAuth 2.0 to secure APIs by default. Therefore, you need an access token to invoke an API.
94+
95+
- Choreo automatically generates a key to test the API via the OpenAPI Console. To view the key, click the show key icon in the **Security Header** field.
96+
- To disable security for the entire API or a specific resource:
97+
1. In the left navigation menu, click **Deploy**.
98+
2. Go to the **Build Area** card and click **Security Settings**.
99+
3. In the **Security Settings** pane:
100+
- To disable security for the entire API, clear the **OAuth2** checkbox.
101+
- To disable security for a specific resource, expand the relevant resource and turn off the **Security** toggle.
102+
4. Click **Apply**.
103+
104+
1. In the left navigation menu, click **Test** and then click **OpenAPI Console**.
105+
2. Select **Development** from the environment drop-down list.
106+
3. Expand the `GET /department/{departmentId}` resource and click **Try it Out**.
107+
4. Enter `1` as the **departmentId** and click **Execute**. You will see a response similar to the following:
108+
109+
![API proxy response](../../assets/img/develop-components/develop-a-rest-api-proxy/rest-api-proxy-response.png){.cInlineImage-full}
110+
111+
This indicates that your API proxy is working as expected.
112+
113+
## Step 5: Manage the API proxy
114+
115+
Now that you have a tested API proxy, you can publish it and make it available for application developers to consume. In this guide, you will apply rate limiting to the API and publish it.
116+
117+
### Step 5.1: Apply rate limiting to the API proxy
118+
119+
1. In the left navigation menu, click **Deploy**.
120+
2. Go to the required environment card and click the settings icon corresponding to **API Configuration**.
121+
3. In the **API Configuration** pane, click **Rate Limiting** to expand the section.
122+
4. Select **API Level** as the **Rate Limiting Level**.
123+
5. Specify appropriate values for the **Request Limit** and **Time Unit** fields. You can proceed with the default values.
124+
6. Click **Apply**. This applies the rate limiting level to the API proxy and redeploys it.
125+
126+
### Step 5.2: Publish the API proxy
127+
128+
1. In the left navigation menu, click **Lifecycle** under **Manage**. This takes you to the **Lifecycle** page.
129+
2. Click **Publish**.
130+
3. In the **Publish API** dialog, click **Confirm** to proceed with publishing the API. If you want to change the display name, make the necessary changes and then click **Confirm**. This changes the API lifecycle state to **Published**.
131+
132+
## Step 6: Invoke the API
133+
134+
To generate credentials for the published API and invoke it via the Choreo Developer Portal, follow these steps:
135+
136+
1. In the **Lifecycle** page, click **Go to Devportal**. This takes you to the `HR API` in the Choreo Developer Portal.
137+
138+
2. **Generate Credentials**:
139+
1. In the Developer Portal left navigation menu, click **Production** under **Credentials**.
140+
2. Click **Generate Credentials**. Choreo generates new tokens and populates the **Consumer Key** and **Consumer Secret** fields.
141+
142+
!!! tip
143+
To test the API via an API test tool or through code, click **Generate Access Token** and copy the test token. Alternatively, click **cURL** and copy the generated cURL command to use via a cURL client. You do not need to generate an access token if you are testing the API via the **Try Out** capability in the Choreo Developer Portal.
144+
145+
3. **Invoke the API**:
146+
1. In the Developer Portal left navigation menu, click **Try Out**.
147+
2. In the **Endpoint** list, select **Development** as the environment to try out the API.
148+
3. Click **Get Test Key** to generate an access token.
149+
4. Expand the `GET /department/{departmentId}` resource and click **Try it out**.
150+
5. Enter `1` as the **departmentId** and click **Execute**. You will see a response similar to the following:
151+
152+
![Try out response](../../assets/img/develop-components/develop-a-rest-api-proxy/try-out-response.png){.cInlineImage-full}
153+
154+
Now, you have gained hands-on experience creating, deploying, testing, and publishing an API proxy using Choreo API Manager.
155+
156+
To learn more about the API management capabilities supported by Choreo API Manager, see [API Management](../../api-management/lifecycle-management.md).

en/mkdocs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ nav:
110110
- Expose a Ballerina GraphQL Endpoint via a Service: develop-components/develop-services/expose-a-ballerina-graphql-endpoint-via-a-service.md
111111
- Expose a Prism-Based Mock Server Using an OpenAPI Specification: develop-components/develop-services/expose-a-prism-based-mock-server-using-an-openapi-specification.md
112112
- Expose a WebSocket Endpoint via a Service: develop-components/develop-services/expose-a-websocket-endpoint-via-a-service.md
113-
- Develop an API Proxy: develop-components/develop-an-api-proxy.md
113+
- Develop an API Proxy:
114+
- Develop a simple proxy: develop-components/develop-proxy/develop-an-api-proxy.md
115+
- Develop a proxy from github repository: develop-components/develop-proxy/develop-an-gh-api-proxy.md
114116
- Develop Web Applications:
115117
- Build and Deploy a Single-Page Web Application: develop-components/develop-web-applications/build-and-deploy-a-single-page-web-application.md
116118
- Develop Web Applications Locally with Choreo’s Managed Authentication: develop-components/develop-web-applications/develop-web-applications-locally-with-managed-authentication.md
@@ -389,7 +391,7 @@ plugins:
389391
'testing/test-apis-with-choreo-testgpt.md': 'https://wso2.com/choreo/docs/testing/test-apis-with-choreo-apichat/'
390392
'develop-integrations/develop-an-event-triggered-integration.md': 'https://wso2.com/choreo/docs/develop-components/develop-integrations/develop-an-event-handler/'
391393
'develop-integrations/develop-a-scheduled-integration.md': 'https://wso2.com/choreo/docs/develop-components/develop-integrations/develop-a-scheduled-task/'
392-
'develop-components/develop-a-rest-api-proxy.md': 'https://wso2.com/choreo/docs/develop-components/develop-an-api-proxy/'
394+
'develop-components/develop-a-rest-api-proxy.md': 'https://wso2.com/choreo/docs/develop-components/develop-proxy/'
393395
'devops-and-ci-cd/builds-and-deployments.md' : 'https://wso2.com/choreo/docs/choreo-concepts/ci-cd/'
394396
'troubleshoot/faq.md': 'https://wso2.com/choreo/docs/references/faq/'
395397
'develop-components/develop-services/develop-a-rest-api.md': 'https://wso2.com/choreo/docs/develop-components/develop-services/develop-a-service/'

en/theme/material/templates/home-page-2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ <h1 style="font-weight: 700; font-size: 43px; line-height: 48px; padding-top: 2.
405405
</svg>
406406
</div>
407407
<div class="cText">
408-
<a href="develop-components/develop-an-api-proxy/">Develop an API Proxy </a>
408+
<a href="develop-components/develop-proxy/">Develop an API Proxy </a>
409409
</div>
410410
</div>
411411
<div class="iconTextcontainer">

0 commit comments

Comments
 (0)