Getting started overview
Integrating with the ELI API involves several steps, from account creation to executing your first authenticated request. ELI provides a comprehensive documentation portal detailing its various API endpoints, including Sentiment Analysis, Entity Extraction, Text Summarization, and Topic Modeling. The API is designed as RESTful, supporting common HTTP methods.
Before making API calls, you will need to sign up for an ELI account and generate API keys. These keys serve as credentials for authenticating your requests, ensuring secure access to ELI's services. ELI offers SDKs for popular programming languages such as Python and Node.js, which streamline the integration process by handling HTTP requests and authentication boilerplate.
A free tier is available, providing 5,000 API calls per month, which is sufficient for initial development and testing. Paid plans, starting at $49/month, offer increased call volumes and additional features. ELI is compliant with GDPR, addressing data privacy concerns for applications handling personal data.
Here’s a quick reference for the getting started process:
| Step | What to Do | Where |
|---|---|---|
| 1. Sign Up | Create an ELI account. | ELI Sign-up Page |
| 2. Get API Key | Generate your API key. | ELI Dashboard |
| 3. Choose SDK/Method | Select your preferred language (Python, Node.js, Java) or use direct HTTP. | ELI SDK Documentation |
| 4. Install SDK (if applicable) | Install the chosen SDK. | ELI SDK Setup Guides |
| 5. Make First Request | Send a basic text analysis request (e.g., Sentiment Analysis). | Sentiment Analysis API Reference |
Create an account and get keys
To begin using ELI, you must first create an account:
- Navigate to the ELI signup page.
- Provide the required information, typically including your email address and a password.
- Complete any email verification steps as prompted.
Once your account is active, you can generate your API keys. These keys are essential for authenticating your requests to the ELI API:
- Log in to your ELI user dashboard.
- Locate the "API Keys" or "Credentials" section, usually found under account settings or a dedicated developer tab.
- Generate a new API key. It is recommended to create separate keys for different applications or environments (e.g., development, production) for better management and security.
- Securely store your API key. Do not embed it directly into client-side code or commit it to public version control systems. Environment variables or secure configuration files are preferred methods for managing API keys. For more information on secure API key handling, review Google Cloud's API key security best practices.
Your first request
After obtaining your API key, you can make your first API call. This example demonstrates how to use the ELI Sentiment Analysis API, which is one of the core products and a common entry point for new users. We will provide examples using both Python and Node.js, reflecting ELI's primary language support for quick integration.
Python Example (using requests library)
First, ensure you have the requests library installed:
pip install requests
Then, execute the following Python code:
import requests
import os
# Replace with your actual API Key, ideally from an environment variable
ELI_API_KEY = os.environ.get("ELI_API_KEY", "YOUR_ELI_API_KEY")
# ELI Sentiment Analysis API endpoint
API_ENDPOINT = "https://api.eli.com/v1/sentiment"
# Text to analyze
text_to_analyze = "The service was excellent, and the product exceeded my expectations!"
headers = {
"Authorization": f"Bearer {ELI_API_KEY}",
"Content-Type": "application/json",
}
payload = {
"text": text_to_analyze
}
try:
response = requests.post(API_ENDPOINT, headers=headers, json=payload)
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
sentiment_data = response.json()
print("Sentiment Analysis Result:")
print(sentiment_data)
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}") # Python 2.6+
except Exception as err:
print(f"Other error occurred: {err}")
Node.js Example (using node-fetch)
First, install node-fetch if you are not in an environment where it's built-in (e.g., Node.js v18+):
npm install node-fetch
Then, execute the following Node.js code:
import fetch from 'node-fetch'; // For Node.js versions < 18, install node-fetch
// Replace with your actual API Key, ideally from an environment variable
const ELI_API_KEY = process.env.ELI_API_KEY || 'YOUR_ELI_API_KEY';
// ELI Sentiment Analysis API endpoint
const API_ENDPOINT = 'https://api.eli.com/v1/sentiment';
// Text to analyze
const textToAnalyze = 'This product is terrible; I am very disappointed.';
async function analyzeSentiment() {
try {
const response = await fetch(API_ENDPOINT, {
method: 'POST',
headers: {
'Authorization': `Bearer ${ELI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: textToAnalyze
}),
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`HTTP error! Status: ${response.status}, Details: ${JSON.stringify(errorData)}`);
}
const sentimentData = await response.json();
console.log('Sentiment Analysis Result:');
console.log(sentimentData);
} catch (error) {
console.error('Error during sentiment analysis:', error);
}
}
analyzeSentiment();
Common next steps
After successfully making your first API call, consider these next steps to deepen your integration with ELI:
- Explore other APIs: ELI offers a range of additional APIs for tasks like Entity Extraction, Text Summarization, and Topic Modeling. Review the API reference to understand their capabilities and integrate them into your application.
- Implement error handling: Robust applications include comprehensive error handling. Familiarize yourself with ELI's error codes and response formats to gracefully manage API failures, rate limit excursions, or invalid requests.
- Utilize SDKs: While direct HTTP calls are viable, using one of ELI's official SDKs (Python, Node.js, Java) can simplify development, handling authentication, request formatting, and response parsing.
- Monitor usage: Keep track of your API call volume through your ELI dashboard to stay within your free tier limits or manage your paid plan usage effectively.
- Review pricing: If your usage scales beyond the free tier, examine the ELI pricing page to determine the most suitable plan for your needs.
- Secure your API keys: As mentioned, never expose your API keys in client-side code or public repositories. Implement server-side calls or secure environment variable management. Twilio's guide on securing API keys provides additional best practices.
Troubleshooting the first call
If your first API call to ELI encounters issues, consider the following common troubleshooting steps:
- Check API Key: Double-check that your API key is correct and has not expired. Ensure there are no leading or trailing spaces if copied manually. The key must be included in the
Authorizationheader asBearer YOUR_ELI_API_KEY. - Endpoint Path: Verify that the API endpoint URL is correct (e.g.,
https://api.eli.com/v1/sentiment). Incorrect paths will result in 404 Not Found errors. - Request Headers: Ensure that the
Content-Type: application/jsonheader is set for POST requests, as shown in the examples. Missing or incorrect headers can lead to 400 Bad Request errors. - Request Body Format: Confirm that the JSON payload in your request body is correctly formatted and adheres to the API's specifications for the chosen endpoint. For instance, the Sentiment Analysis API expects a
textfield. - Network Connectivity: Confirm your development environment has internet access and no firewall rules are blocking outgoing requests to
api.eli.com. - Rate Limiting: While unlikely on a first call, excessive requests can lead to 429 Too Many Requests errors. Review ELI's rate limit documentation if you are making multiple rapid requests.
- Error Messages: Pay close attention to the error messages returned in the API response. ELI's detailed error responses can often pinpoint the exact issue. For example, a 401 Unauthorized typically indicates an issue with the API key.
- SDK vs. Raw HTTP: If you are using an SDK, ensure it is correctly installed and imported. If issues persist, try making a raw HTTP request (e.g., using
curlor a tool like Postman) to isolate whether the problem is with your code or the SDK. - ELI Documentation: Consult the ELI troubleshooting guide and specific API reference pages for more detailed information on common issues and their resolutions.