You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
621 B
27 lines
621 B
#!/bin/bash |
|
|
|
reset |
|
|
|
clear |
|
|
|
set -e |
|
|
|
set -x |
|
|
|
# Define the API endpoint URL with root and path |
|
API_URL="http://aventador.embanet.online:5000/complex_process" |
|
|
|
# Data to send in JSON format |
|
DATA='{"string": "test", "num1": 10, "num2": 20}' |
|
|
|
# Send POST request using curl with provided data |
|
response=$(curl -s -X POST -H "Content-Type: application/json" -d "$DATA" $API_URL) |
|
|
|
# Check for successful response (exit code 0) and extract the result |
|
if [[ $? -eq 0 ]]; then |
|
result=$(echo $response | jq -r '.result') |
|
echo "API responded successfully with result: $result" |
|
else |
|
echo "Error: API request failed!" |
|
exit 1 |
|
fi
|
|
|