Skip to content

Commit

Permalink
Update file download for QSG sample json
Browse files Browse the repository at this point in the history
  • Loading branch information
sgayangi committed Nov 18, 2024
1 parent 12b162f commit c9e0041
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
}
}
}
},
}
},
"/employee": {
"post": {
"tags": [
"employee-controller"
Expand Down
15 changes: 0 additions & 15 deletions en/docs/get-started/downloadFile.js

This file was deleted.

26 changes: 3 additions & 23 deletions en/docs/get-started/quick-start-guide-with-cp.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ Install the <a href="../../setup/prerequisites" target="_blank">prerequisites</a

## Step 2 - Create and Deploy the API From Dataplane

1. Download and save the sample
<a href="https://raw.githubusercontent.com/wso2/docs-apk/refs/heads/1.2.0/en/docs/assets/files/get-started/EmployeeServiceDefinition.json"
target="_blank" onclick="downloadFile(event)">EmployeeServiceDefinition.json</a> file. This is the OAS definition of the API that we are going to deploy in APK.
1. Download and save the sample <a href="../../assets/files/get-started/EmployeeServiceDefinition.json" target="_blank" download>EmployeeServiceDefinition.json</a> file. This is the OAS definition of the API that we are going to deploy in APK.
2. Add a hostname mapping to the ```/etc/hosts``` file as follows.

| IP | Domain name |
Expand Down Expand Up @@ -134,7 +132,7 @@ operations:
```

!!! Important
We recommend installing the <a href="{{base_path}}/en/{{site_version}}/api-management-overview/apk-conf-lang-support/" target="_blank">APK Config Language Support Visual Studio Code (VS Code) extension</a> to edit the APK Configuration file.
We recommend installing the <a href="../../api-management-overview/apk-conf-lang-support/" target="_blank">APK Config Language Support Visual Studio Code (VS Code) extension</a> to edit the APK Configuration file.


### Deploy the API in APK DataPlane
Expand Down Expand Up @@ -257,22 +255,4 @@ kubectl get pods -n apk
curl -X GET "https://carbon.super.gw.wso2.com:9095/employees-info/3.14/employees" -H "Authorization: Bearer <access-token>" -k
```
You will now be able to see a successful response with the details of the Employees from the mock backend that we used for this guide.
<script>
function downloadFile(event) {
event.preventDefault();
const url = event.target.href;
const fileName = "EmployeeServiceDefinition.json";
fetch(url)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.click();
URL.revokeObjectURL(link.href);
})
.catch(console.error);
}
</script>
You will now be able to see a successful response with the details of the Employees from the mock backend that we used for this guide.
37 changes: 7 additions & 30 deletions en/docs/get-started/quick-start-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ kubectl get pods

## Step 3 - Create and Deploy the API

1. Download and save the sample
<a href="https://raw.githubusercontent.com/wso2/docs-apk/refs/heads/1.2.0/en/docs/assets/files/get-started/EmployeeServiceDefinition.json"
target="_blank" onclick="downloadFile(event)">EmployeeServiceDefinition.json</a> file. This is the OAS definition of the API that we are going to deploy in APK.
1. Add a hostname mapping to the ```/etc/hosts``` file as follows.
1. Download and save the sample <a href="../../assets/files/get-started/EmployeeServiceDefinition.json" target="_blank" download>EmployeeServiceDefinition.json</a> file. This is the OAS definition of the API that we are going to deploy in APK.
2. Add a hostname mapping to the ```/etc/hosts``` file as follows.

| IP | Domain name |
| --------- | ------------------- |
Expand All @@ -60,7 +58,6 @@ kubectl get pods

Apart from the above API definition file, we also need an `apk-conf` file that defines the configurations and metadata for this API. We have a configuration service that can be used to generate this apk-conf file when the OpenAPI definition is provided.


1. Execute the following request to generate the APK configuration. Use the values provided in the table below in the body of your request.

| Field | Value |
Expand Down Expand Up @@ -112,7 +109,6 @@ Apart from the above API definition file, we also need an `apk-conf` file that d
--form 'definition=@"<path/to/EmployeeServiceDefinition.json>"'
```


2. You will get the apk-conf file content as the response. Save this content into a file named `EmployeeService.apk-conf`. You can edit these values as necessary. Let's change the basepath from the autogenerated value to "/employees-info". Your apk-conf file should now appear as follows.

```
Expand Down Expand Up @@ -145,8 +141,7 @@ operations:
```

!!! Important
We recommend installing the <a href="{{base_path}}/en/{{site_version}}/api-management-overview/apk-conf-lang-support/" target="_blank">APK Config Language Support Visual Studio Code (VS Code) extension</a> to edit the APK Configuration file.

We recommend installing the <a href="../../api-management-overview/apk-conf-lang-support/" target="_blank">APK Config Language Support Visual Studio Code (VS Code) extension</a> to edit the APK Configuration file.

### Generate an access token to invoke APIs

Expand Down Expand Up @@ -262,7 +257,7 @@ You now have the API Definition (`EmployeeServiceDefinition.json`) and the apk-c

Now the API is ready to be invoked. Let’s get the list of employees by invoking the `/employees` resource in the `EmployeeServiceAPI`.

1. Execute the following request to invoke the API. Make sure to provide the access token obtained in the previous step under ["Generate an access token to invoke APIs"](#generate-an-access-token-to-invoke-apis) section as the `Authorization` header in this request.
1. Execute the following request to invoke the API. Make sure to provide the access token obtained in the previous step under [Generate an access token to invoke APIs](#generate-an-access-token-to-invoke-apis) section as the `Authorization` header in this request.


=== "Sample Request"
Expand Down Expand Up @@ -307,24 +302,6 @@ Now the API is ready to be invoked. Let’s get the list of employees by invokin
You will now be able to see a successful response with the details of the employees from the mock backend that we used for this guide.

!!!Note
To invoke the APIs, we need a valid access token issued by an identity provider (IdP). APK supports third-party IdPs such as Asgardeo and Auth0. Refer <a href="{{base_path}}/en/latest/setup/identity-platform/idp/idp-overview/" target="_blank">Configure IDP</a>.

If you encounter any issues during the installation process, don't worry! We've compiled a list of frequently asked questions (FAQs) to help you troubleshoot common problems. Please refer to the <a href="{{base_path}}/en/{{site_version}}/about-apk/FAQs#installation-and-deployment" target="_blank">FAQs</a> section in this guide for step-by-step solutions to common installation issues.

<script>
function downloadFile(event) {
event.preventDefault();
const url = event.target.href;
const fileName = "EmployeeServiceDefinition.json";
fetch(url)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.click();
URL.revokeObjectURL(link.href);
})
.catch(console.error);
}
</script>
To invoke the APIs, we need a valid access token issued by an identity provider (IdP). APK supports third-party IdPs such as Asgardeo and Auth0. Refer <a href="../../setup/identity-platform/idp/idp-overview/" target="_blank">Configure IDP</a>.

If you encounter any issues during the installation process, don't worry! We've compiled a list of frequently asked questions (FAQs) to help you troubleshoot common problems. Please refer to the <a href="../../about-apk/FAQs#installation-and-deployment" target="_blank">FAQs</a> section in this guide for step-by-step solutions to common installation issues.

0 comments on commit c9e0041

Please sign in to comment.