mirror of
https://github.com/Redume/Kekkai.git
synced 2025-04-02 21:37:36 +03:00
Compare commits
3 commits
9c9d0352c6
...
6269512daa
Author | SHA1 | Date | |
---|---|---|---|
6269512daa | |||
ac52635834 | |||
9d6b54b0e4 |
4 changed files with 210 additions and 9 deletions
|
@ -28,7 +28,11 @@ export default defineConfig({
|
|||
items: [
|
||||
{
|
||||
label: 'Endpoints list', slug: 'docs/endpoints/endpoints-list'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Get currency rate - /api/getRate',
|
||||
slug: 'docs/endpoints/getrate'
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -14,8 +14,8 @@ https://kekkai.redume.su/api/
|
|||
Kekkai has 3 API endpoints: `getRate`, `getChart` and `metadata`.
|
||||
Below you will find a list of parameters that each endpoint requires and a description of what the API does.
|
||||
|
||||
| Service | API Endpoint | Description |
|
||||
|--------------|------------------------------------------|---------------------------------------------------------------------------------------------|
|
||||
| Get Rate | `https://kekkai.redume.su/api/getRate/` | Get currency exchange rate for a specific day or period |
|
||||
| Create Chart | `https://kekkai.redume.su/api/getChart/` | Creating a chart with exchange rate |
|
||||
| Metadata | `https://kekkai.redume.su/api/metadata/` | Shows the last and first dates of currency rate collection, as well as available currencies |
|
||||
| Service | API Endpoint | Description |
|
||||
|--------------|----------------------------------------------|---------------------------------------------------------------------------------------------|
|
||||
| Get Rate | `https://kekkai-api.redume.su/api/getRate/` | Get currency exchange rate for a specific day or period |
|
||||
| Create Chart | `https://kekkai-api.redume.su/api/getChart/` | Creating a chart with exchange rate |
|
||||
| Metadata | `https://kekkai-api.redume.su/api/metadata/` | Shows the last and first dates of currency rate collection, as well as available currencies |
|
199
docs/src/content/docs/docs/endpoints/getrate.mdx
Normal file
199
docs/src/content/docs/docs/endpoints/getrate.mdx
Normal file
|
@ -0,0 +1,199 @@
|
|||
---
|
||||
title: Get currency rate - /api/getRate
|
||||
---
|
||||
|
||||
Currencies are identified by standard three-letter `ISO 4217` codes.
|
||||
|
||||
import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
|
||||
|
||||
|
||||
## Getting the currency rate for a certain day.
|
||||
### Request
|
||||
|
||||
<Tabs>
|
||||
<TabItem label='Shell'>
|
||||
<Tabs>
|
||||
<TabItem label='curl'>
|
||||
```shell
|
||||
curl --request GET --url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&date=2024-10-16
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem label='Python'>
|
||||
<Tabs>
|
||||
<TabItem label='requests'>
|
||||
```python
|
||||
import requests
|
||||
|
||||
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
|
||||
'from_currency': 'RUB',
|
||||
'conv_currency': 'USD',
|
||||
'date': '2024-10-16',
|
||||
}, timeout=3)
|
||||
|
||||
print(res.json())
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem label='Node.JS'>
|
||||
<Tabs>
|
||||
<TabItem label='axios'>
|
||||
```javascript
|
||||
const axios = require('axios');
|
||||
|
||||
axios.get('https://kekkai-api.redume.su/api/getRate/', {
|
||||
timeout: 3000,
|
||||
'from_currency': 'RUB',
|
||||
'conv_currency': 'USD',
|
||||
'date': '2024-10-16',
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(JSON.stringify(res.json()));
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Query Parameters
|
||||
| Parameter | Description |
|
||||
|-------------------|------------------------------------------------------------------------|
|
||||
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
|
||||
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
|
||||
| `date`* | Currency rate date in the format `YYYYY-DD-MM` |
|
||||
| `conv_amount` | Multiplier for number conversion (Optional) |
|
||||
|
||||
`*` - Required arguments
|
||||
|
||||
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<Aside title='Output'>
|
||||
```json
|
||||
[
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-17T00:00:00.000Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
</Aside>
|
||||
|
||||
|
||||
## Get currency exchange rate for a certain period
|
||||
Getting the list of the array with currency rate for a certain period of time.
|
||||
|
||||
|
||||
### Request
|
||||
<Tabs>
|
||||
<TabItem label='Shell'>
|
||||
<Tabs>
|
||||
<TabItem label='curl'>
|
||||
```shell
|
||||
curl --request GET --url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&start_date=2024-10-16&end_date=2024-10-20
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem label='Python'>
|
||||
<Tabs>
|
||||
<TabItem label='requests'>
|
||||
```python
|
||||
import requests
|
||||
|
||||
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
|
||||
'from_currency': 'RUB',
|
||||
'conv_currency': 'USD',
|
||||
'start_date': '2024-10-16',
|
||||
'end_date': '2024-10-20',
|
||||
}, timeout=3)
|
||||
|
||||
print(res.json())
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem label='Node.JS'>
|
||||
<Tabs>
|
||||
<TabItem label='axios'>
|
||||
```javascript
|
||||
const axios = require('axios');
|
||||
|
||||
axios.get('https://kekkai-api.redume.su/api/getRate/', {
|
||||
timeout: 3000,
|
||||
'from_currency': 'RUB',
|
||||
'conv_currency': 'USD',
|
||||
'start_date': '2024-10-16',
|
||||
'end_date': '2024-10-20',
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(JSON.stringify(res.json()));
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Query parameters
|
||||
| Parameter | Description |
|
||||
|------------------|-------------------------------------------------------------------------|
|
||||
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
|
||||
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
|
||||
| `start_date`* | Start date of the period in the format `YYYYY-DD-MM` |
|
||||
| `end_date`* | Period end date in the format `YYYYY-DD-MM` |
|
||||
|
||||
`*` - Required arguments
|
||||
|
||||
### Response
|
||||
<Aside title='Output'>
|
||||
```json
|
||||
[
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-17T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-18T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-19T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-20T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"from_currency": "RUB",
|
||||
"conv_currency": "USD",
|
||||
"rate": 0.01,
|
||||
"date": "2024-10-21T00:00:00.000Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
</Aside>
|
|
@ -7,9 +7,7 @@ Below are the steps to deploy Kekkai with Docker Compose.
|
|||
|
||||
Kekkai requires Docker Compose version 2.x.
|
||||
|
||||
import { Steps } from '@astrojs/starlight/components';
|
||||
import { Code } from '@astrojs/starlight/components';
|
||||
|
||||
import { Steps, Code } from '@astrojs/starlight/components';
|
||||
|
||||
<Steps>
|
||||
1. Preparing files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue