Pangeanic Translation API

Created by Sebastian David Garcia Saiz, Modified on Fri, 8 Aug at 10:26 AM by Sebastian David Garcia Saiz

User Manual - Glossary API

Introduction

This API allows managing glossaries associated with translation or processing engines. The available endpoints allow: listing glossaries, deleting glossaries, and adding new glossaries. All endpoints are accessible via the HTTP POST method.

Authentication

All endpoints require the apikey parameter to authenticate the user. If not provided, the API will respond with a 400 error.

Endpoint: Obtain Glossaries

URL: /glossaries

Method: POST

Content-Type: application/json; charset=UTF-8

Description: Returns a list of available glossaries for the apikey, optionally filtered by glossaryid.

Example of a request

        {
           "apikey": "your_apikey",
           "glossaryid": 123  // Optional to select a glossary
         }

Successful Response

[
   {
     "id": 1,
     "name": "Medical Glossary",
     "path": "/glossaries/medico.csv"
   },
   {
     "id": 2,
     "name": "Legal Glossary",
     "path":
   "/glossaries/legal.csv" 
 }]

 

Common Errors

- 400: Malformed JSON or missing apikey -
 401: Unexpected error retrieving glossaries

Endpoint: Remove Glossary

URL: /deleteglossary

Method: POST

Content-Type: application/json; charset=UTF-8

Description: Remove a specific glossary.

Example of a request

{
   "apikey": "your_apikey",
   "glossaryid": 
 

Successful Response

{
   "status": "success",
   "message": Glossary successfully 
 deleted

Common Errors

- 400: Missing apikey or glossaryid
- 401: Unexpected error
 - 500: Database error

Endpoint: Add Glossary

URL: /addglossary

Method: POST

Content-Type: multipart/form-data

Description: Allows you to upload a glossary file and associate it with a engine.

Form Parameters

Field

Type    

Description

file        

file

Glossary file

name        

string  

Glossary name

engineid    

int     

Associated engine ID

apikey      

string  

Authentication key

 

Example of a Successful Response

{
   "status": "success",
   "message": "Glossary added successfully",
   "id": 
 

Common Errors

- 400: Some of the required fields are missing
- 401: Unexpected error
 - 500: Database error

Usage examples with curl

Obtain glossaries

curl -X POST http://tuapi.com/glossaries \
   -H "Content-Type: application/json" \
   -d '{"apikey":"abc123"}'

Remove glossary

curl -X POST http://tuapi.com/deleteglossary \
   -H "Content-Type: application/json" \
   -d '{"apikey":"abc123", "glossaryid": 1}'

Add glossary

curl -X POST http://tuapi.com/addglossary \
   -F "file=@/path/to/file.csv" \
   -F "name=New Glossary" \
   -F "engineid=2" \
   -F "apikey=abc123"

 

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article