The My API offers a set of endpoints that enable users to perform various statistical calculations, such as computing confidence intervals, conducting t-tests, and generating descriptive statistics, among others. The API is designed to be user-friendly, utilizing simple POST requests that accept JSON data as input and return results in JSON format.
This API is suitable for educational purposes, data analysis projects, or any applications requiring quick statistical insights. Users can choose different confidence levels, sample data, or statistical methods through flexible parameters.
Before getting started, please ensure you are familiar with the following:
POST
requests with JSON-formatted data.Content-Type
header is set toapplication/json
.https://api.sunnytseng.com/
You can access various functionalities through different endpoints and parameters.
{"data": [10, 20, 30], "CI": 90}
curl -X POST -H "Content-Type: application/json" -d "{\"data\": [10, 20, 30, 40, 50], \"CI\": 90}" https://api.sunnytseng.com/CI
You can use the curl command to test the API. For example, you can calculate the mean confidence interval as follows:
Make sure to use the correct HTTP method and headers to ensure proper communication with the API.
import requests
import json
url = "https://api.sunnytseng.com/CI"
payload = {
"data": [10, 20, 30, 40, 50],
"CI": 90
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code} - {response.text}")
Here’s an example of how to call the API using Python's requests module:
You can adjust the endpoint and parameters to access different API functionalities as needed.