Skip to content

Commit

Permalink
Merge pull request #13 from appatalks/appatalks-yahoo-example
Browse files Browse the repository at this point in the history
Adding yahoo example
  • Loading branch information
appatalks authored Jul 6, 2024
2 parents 958d64a + 46c5229 commit cab2ae7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ A simple FIFO API Gateway for managing API calls, storing them in MySQL, and pro
- Save Yahoo Finance API Call
```bash
curl -X POST http://localhost:8000/api/save -H "Content-Type: application/json" -d '{"data": "{\"headers\": {\"Accept\":
curl -k -X POST https://localhost:5000/api/save -H "Content-Type: application/json" -d '{"data": "{\"headers\": {\"Accept\":
\"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\", \"url\":
\"https://query1.finance.yahoo.com/v8/finance/chart/AAPL?interval=1d\"}}"}'
{"status":"success"}
Expand Down
17 changes: 17 additions & 0 deletions delivery/yahoo_finance_api_delivery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e

API_DELIVER_ENDPOINT="https://localhost:5000/api/deliver"

fetch_data_from_api_gateway() {
curl -k -s -X GET "$API_DELIVER_ENDPOINT" -H "Content-Type: application/json"
}

results=$(fetch_data_from_api_gateway)
data=$(echo "$results" | jq -r '.data')
decoded_data=$(echo "$data")
url=$(echo "$decoded_data" | jq -r '.headers.url')
response=$(curl -s "$url")

# Print response from Yahoo Finance API
echo "$response"

0 comments on commit cab2ae7

Please sign in to comment.