Your First API Call
Let's test your Heimdall connection with a simple API call to the Unstructured Suite for text analysis.
Prerequisites
- Heimdall account created
- Unstructured API key obtained
- Python installed (or any HTTP client)
Test with Text Analysis
Here's a simple example to analyze some text using your unstructured API key:
import requests
# Your API credentials
url = 'https://read.heimdallapp.org/read/v1/api/process'
headers = {
'X-api-key': 'YOUR-UNSTRUCTURED-API-KEY',
'X-username': 'YOUR-USERNAME'
}
# Sample text to analyze
data = {
"text": "Heimdall is an amazing machine learning platform that makes data science simple and accessible for everyone."
}
# Make the API call and get the response
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Expected Response
You should receive a comprehensive JSON response with detailed text analysis:
{
"length": 108,
"word_count": 17,
"oov_ratio": 0.17647058823529413,
"oov_ratio_2": 0.29411764705882354,
"sentence_count": 1,
"avg_word_length": 5.470588235294118,
"avg_sentence_length": 17,
"noun_count": 7,
"verb_count": 3,
"adjective_count": 2,
"adverb_count": 0,
"pronoun_count": 0,
"stopword_count": 5,
"tfidf_top1": "accessible",
"tfidf_top2": "amazing",
"tfidf_top3": "data",
"sentiment": "positive",
"compound_sentiment_score": 0.5859
}
Common Issues
401 Unauthorized - Check your API key and username, ensure headers are correctly formatted
422 Unprocessable Entity - Verify your request body structure, check that text doesn't contain line breaks or double quotes
500 Internal Server Error - Contact support if this persists
Next Steps
Great! You've successfully made your first API call. Now you can:
- Start Processing Data - Process different types of data
- Try Text Analysis - Deep dive into text processing
- Explore Image Analysis - Work with image processing
- Build Your First Model - Create ML models
Need Help?
If you're having trouble with your first API call, check our troubleshooting guide or contact support.