#!/bin/bash

# to run this script ./curl_script.sh

# URL to send the request
URL_microSpot="http://api-prod.uspot.probesys.net:81/nebuleair?token=2AFF6dQk68daFZ"
URL_microSpot_HTTPS="https://api-prod.uspot.probesys.net:443/nebuleair?token=2AFF6dQk68daFZ"
URL_airCarto_HTTPS="https://aircarto.fr/tests/test.php"
URL_webhook="https://webhook.site/6bee2237-099a-4ff4-8452-9f4126df7151"

CERT_PATH="/var/www/nebuleair_pro_4g/SARA/SSL/certificate/e6.pem"
CIPHER="TLS_AES_256_GCM_SHA384"
#CIPHER="TLS_AES_256_GCM_SHA384"
#CIPHER="POLY1305_SHA256"

# JSON payload to send
PAYLOAD='{
    "nebuleairid": "C04F8B8D3A08",
    "software_version": "ModuleAir-V1-012023",
    "sensordatavalues": [
        {"value_type": "NPM_P0", "value": "2.3"},
        {"value_type": "NPM_P0", "value": "3.30"},
        {"value_type": "NPM_P1", "value": "9.05"},
        {"value_type": "NPM_P2", "value": "20.60"},
        {"value_type": "NPM_N1", "value": "49.00"},
        {"value_type": "NPM_N10", "value": "49.00"},
        {"value_type": "NPM_N25", "value": "49.00"}
    ]
}'

# Perform the curl command
curl --http1.1 -v -X POST "$URL_microSpot_HTTPS" \
    --tlsv1.2 \
    --cacert "$CERT_PATH" \
    -d "$PAYLOAD"
