Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bijira Samples to Match New UI #4

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .samples/icons/cloudmersive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .samples/icons/openai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .samples/icons/openweathermap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions .samples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
]
},
{
"name": "OpenWeatherMap Sample API",
"displayName": "OpenWeatherMap Sample API",
"description": "A sample API proxy that interacts with OpenWeatherMap API.",
"name": "Cloudmersive Currency API",
"displayName": "Cloudmersive Currency API",
"description": "A sample API proxy that interacts with Cloudmersive Currency API.",
"componentType": "API-proxy",
"repositoryUrl": "https://github.com/wso2/bijira-samples/",
"componentPath": "/openweathermap-api",
"thumbnailPath": "https://raw.githubusercontent.com/wso2/bijira-samples/main/.samples/icons/openweathermap.svg",
"documentationPath": "/openweathermap-api/readme.md",
"componentPath": "/cloudmersive-currency-api",
"thumbnailPath": "https://raw.githubusercontent.com/wso2/bijira-samples/refs/heads/main/.samples/icons/cloudmersive.svg",
"documentationPath": "/cloudmersive-currency-api/readme.md",
"buildPack": "none",
"tags": [
"API Proxy",
Expand Down
48 changes: 48 additions & 0 deletions cloudmersive-currency-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Creating a Cloudmersive Currency API Proxy

## Use Case

The Cloudmersive Currency API Proxy in Bijira enables seamless integration with Cloudmersive’s currency conversion services, allowing users to access real-time exchange rates and currency conversion functionalities securely and efficiently. This use case focuses on setting up an API proxy to facilitate currency-related functionalities such as currency conversion, exchange rate retrieval, and historical currency data.

The following steps will guide you through the process of creating and deploying the Cloudmersive Currency API Proxy component in Bijira:

1. **Create the Currency API Proxy**: Set up an API proxy in Bijira to connect with Cloudmersive’s services.
2. **Configure and Deploy the Currency API**: Adjust settings and deploy the proxy for external access.
3. **Test the API Proxy**: Use the OpenAPI Console in Bijira to verify the API’s functionality.

## Run the Sample in Bijira

### Prerequisites

- A valid Bijira account with sufficient resource quota.
- A Cloudmersive API key, which you can obtain by signing up at [https://account.cloudmersive.com/](https://account.cloudmersive.com/).

### Create the API Proxy

1. Visit [https://console.bijira.dev/](https://console.bijira.dev/) and sign in to your account.
2. Under **Third-Party APIs (Egress)**, select the **Import API Contract** option.
3. Choose **URL** and provide the following URL to import the API contract from the GitHub repository:
```
https://raw.githubusercontent.com/wso2/bijira-samples/refs/heads/main/cloudmersive-currency-api/openapi.yaml
```
4. Click **Next**, then review and modify the pre-defined settings as needed. Default values can be used for this sample.
5. Click **Create** to initialize the Currency API Proxy and wait for the setup to complete.

### Configure the Service Contract

1. Navigate to **Develop → Policy Section**.
2. Click the settings icon next to the **Service Contract URL
3. In the **API Key Header** field, enter `Apikey`.
4. In the **API Key Value** field, enter your Cloudmersive API key.
5. Click **Save** to apply the changes.

### Deploy the API Proxy

1. Go to the **Deploy** page of the API Proxy.
2. Click the **Deploy** button to re-deploy the API Proxy.
3. Wait for the deployment to complete.

## Test the API Proxy

1. Navigate to the **Test → OpenAPI Console** page of the API Proxy.
2. Use the OpenAPI Console to send test requests and validate the API Proxy’s functionality.
197 changes: 197 additions & 0 deletions cloudmersive-currency-api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
openapi: 3.0.1
info:
title: Cloudmersive Currency API
description: This is the Cloudmersive Currency API. It provides currency exchange rates and currency conversion services.
version: v1
servers:
- url: https://testapi.cloudmersive.com/
paths:
/currency/exchange-rates/list-available:
post:
tags:
- CurrencyExchange
summary: Get a list of available currencies and corresponding countries
description: Enumerates available currencies and the countries that correspond
to these currencies.
operationId: Currency Exchange_Get Available Currencies
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AvailableCurrencyResponse'
text/json:
schema:
$ref: '#/components/schemas/AvailableCurrencyResponse'
application/xml:
schema:
$ref: '#/components/schemas/AvailableCurrencyResponse'
text/xml:
schema:
$ref: '#/components/schemas/AvailableCurrencyResponse'
security:
- Apikey: []
/currency/exchange-rates/convert/{source}/to/{destination}:
post:
tags:
- CurrencyExchange
summary: Converts a price from the source currency into the destination currency
description: Automatically converts the price in the source currency into the
destination currency using the latest available currency exchange rate data.
operationId: Currency Exchange_Convert Currency
parameters:
- name: source
in: path
description: Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
required: true
schema:
type: string
- name: destination
in: path
description: Destination currency three-digit code (ISO 4217), e.g. USD, EUR,
etc.
required: true
schema:
type: string
requestBody:
description: Input price, such as 19.99 in source currency
content:
application/json:
schema:
type: number
format: double
text/json:
schema:
type: number
format: double
required: true
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ConvertedCurrencyResult'
text/json:
schema:
$ref: '#/components/schemas/ConvertedCurrencyResult'
application/xml:
schema:
$ref: '#/components/schemas/ConvertedCurrencyResult'
text/xml:
schema:
$ref: '#/components/schemas/ConvertedCurrencyResult'
security:
- Apikey: []
x-codegen-request-body-name: sourcePrice
/currency/exchange-rates/get/{source}/to/{destination}:
post:
tags:
- CurrencyExchange
summary: Gets the exchange rate from the source currency into the destination
currency
description: Automatically gets the exchange rate from the source currency into
the destination currency using the latest available currency exchange rate
data.
operationId: Currency Exchange_Get Exchange Rate
parameters:
- name: source
in: path
description: Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
required: true
schema:
type: string
- name: destination
in: path
description: Destination currency three-digit code (ISO 4217), e.g. USD, EUR,
etc.
required: true
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeRateResult'
text/json:
schema:
$ref: '#/components/schemas/ExchangeRateResult'
application/xml:
schema:
$ref: '#/components/schemas/ExchangeRateResult'
text/xml:
schema:
$ref: '#/components/schemas/ExchangeRateResult'
security:
- Apikey: []
components:
schemas:
AvailableCurrencyResponse:
type: object
properties:
Currencies:
type: array
description: List of available currencies from the API
items:
$ref: '#/components/schemas/AvailableCurrency'
description: Result of performing an enumerate currencies operation
AvailableCurrency:
type: object
properties:
ISOCurrencyCode:
type: string
description: ISO 4217 currency three-letter code associated with the country
CurrencySymbol:
type: string
description: Symbol associated with the currency
CurrencyEnglishName:
type: string
description: Full name of the currency
CountryName:
type: string
description: Name of the country
CountryThreeLetterCode:
type: string
description: Three-letter ISO 3166-1 country code
CountryISOTwoLetterCode:
type: string
description: Two-letter ISO 3166-1 country code
IsEuropeanUnionMember:
type: boolean
description: True if this country is currently a member of the European
Union (EU), false otherwise
description: Details of a specific currency
ConvertedCurrencyResult:
type: object
properties:
ConvertedPrice:
type: number
description: The converted price in the destination currency
format: double
ISOCurrencyCode:
type: string
description: ISO 4217 currency three-letter code of destination price
CurrencySymbol:
type: string
description: Destination currency symbol
FormattedPriceAsString:
type: string
description: Formatted price in the destination currency as a string
description: Result of performing a Convert Currency operation
ExchangeRateResult:
type: object
properties:
ExchangeRate:
type: number
description: The exchange rate from the source to the destination currency
format: double
description: Result of performing a get exchange rate operation
securitySchemes:
Apikey:
type: apiKey
description: Represents API Key `Apikey`
name: Apikey
in: header
Loading