Master the WCC NLP API: 6 Endpoints Explained Step‑by‑Step
Master the WCC NLP API: 6 Endpoints Explained Step‑by‑Step
The **WCC NLP API** gives developers a ready‑made suite of natural‑language functions that can be added to any application with a single HTTP request. Below is a concise, practical guide to each of the six endpoints, the required parameters, and typical response structures. Follow the steps to integrate the API quickly and keep your code SEO‑friendly.
---
1. `POST /v1/sentiment` – Sentiment Analysis
**Purpose:** Returns a polarity score (`positive`, `neutral`, `negative`) and a confidence value (0‑1).
**Request body (JSON):**
```json
{
"text": "Your input string goes here."
}
```
**Key steps:**
1. Set `Content-Type: application/json`.
2. Include your API key in the `Authorization` header (`Bearer <key>`).
3. Send the request and parse the `sentiment` and `confidence` fields from the JSON response.
**Typical response:**
```json
{
"sentiment": "positive",
"confidence": 0.92
}
```
---
2. `POST /v1/entities` – Entity Extraction
**Purpose:** Identifies named entities (people, organizations, locations) and returns their type and offset.
**Request body:**
```json
{
"text": "Apple announced a new campus in Cupertino."
}
```
**Response highlights:**
```json
{
"entities": [
{"text":"Apple","type":"Organization","start":0,"end":5},
{"text":"Cupertino","type":"Location","start":34,"end":42}
]
}
```
---
3. `POST /v1/keyphrases` – Key Phrase Detection
**Purpose:** Generates a list of the most important phrases in a document.
**Request body:**
```json
{
"text": "Machine learning enables computers to learn from data without explicit programming."
}
```
**Response example:**
```json
{
"keyphrases": [
"machine learning",
"computers",
"data",
"explicit programming"
]
}
```
---
4. `POST /v1/summarize` – Text Summarization
**Purpose:** Produces a concise summary (up to 3 sentences) from longer content.
**Request body:**
```json
{
"text": "Long article …"
}
```
**Response:**
```json
{
"summary": "The article outlines the benefits of AI in healthcare, focusing on diagnostic accuracy and cost reduction."
}
```
---
5. `POST /v1/language-detect` – Language Detection
**Purpose:** Detects the ISO‑639‑1 language code of the supplied text.
**Request body:**
```json
{
"text": "Bonjour tout le monde"
}
```
**Response:**
```json
{
"language": "fr",
"confidence": 0.99
}
```
---
6. `POST /v1/translate` – Machine Translation
**Purpose:** Translates text from a source language to a target language.
**Request body:**
```json
{
"text": "Hello, world!",
"source": "en",
"target": "es"
}
```
**Response:**
```json
{
"translation": "¡Hola, mundo!"
}
```
---
Quick Integration Checklist
| Item | Action |
|------|--------|
| API Key | Store securely; never hard‑code in client‑side code. |
| Rate Limits | Respect the default 60 req/min limit; implement exponential back‑off. |
| Error Handling | Check for HTTP 4xx/5xx; parse the `error` object for diagnostics. |
| Logging | Record request IDs (`X-Request-ID`) for audit trails. |
By following these steps, you can add robust NLP capabilities to blogs, e‑commerce platforms, or internal analytics tools while keeping your implementation lightweight and SEO‑optimized.
**For a seamless development experience, consider using Wild Cherry Capital's tools for this.**