API & modules

API Basic - Notice

The Basic API allows you to search, from a french or an occitan word, an entry of the Basic, Lo Congrès dictionary.

Input URL

The application basic URL is http://api.locongres.org/basic.php. You have to add mandatory parameters and you can add a facultative parameter. If you don't know how to add parameters in an URL, you can read this tutorial.

Mandatory parameters

You have to add the following parameters :

  • Your API key : to use Lo Congrès API, you have to specify a personal API key you can get on the dedicate page. You specify the API key with the "key" parameter.
  • Language : you have to specify in which language you will give the word you want to search with the "lang" parameter. It allows the values "fr" (for french) and "oc" (for occitan).
  • Term : you have to specify the term you want to search with the "term" parameter.

For instance, you can search the occitan translations of the word "parler" with the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=parler. You get the following result :

{
    "query": [
        {
            "id": 0,
            "forms": [
                {
                    "orth": "parler",
                    "PoS": [
                        "V000050000000"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "parlar",
                    "PoS": [
                        "V000050000000"
                    ]
                }
            ]
        }
    ]
}

You can search what is the french translation of the word "aimable" with the URL http://api.locongres.org/basic.php?key=[your_APIkey]&term=aimable&lang=oc. You get the following result :

{
    "query": [
        {
            "id": 0,
            "forms": [
                {
                    "orth": "affable",
                    "PoS": [
                        "AJ0110",
                        "AJ0210"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "aimable",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "aimabla",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                },
                {
                    "var": "oc",
                    "orth": "agradiu",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "agradiva",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "id": 0,
            "forms": [
                {
                    "orth": "aimable",
                    "PoS": [
                        "AJ0110",
                        "AJ0210"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "aimable",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "aimabla",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                },
                {
                    "var": "oc",
                    "orth": "amist\u00f3s",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "amistosa",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "id": 0,
            "forms": [
                {
                    "orth": "gentil",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "orth": "gentille",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "brave",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "brava",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                },
                {
                    "var": "oc",
                    "orth": "aimable",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "aimabla",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "id": 0,
            "forms": [
                {
                    "orth": "sympathique",
                    "PoS": [
                        "AJ0110",
                        "AJ0210"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "simpatic",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "simpatica",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                },
                {
                    "var": "oc",
                    "orth": "aimable",
                    "PoS": [
                        "AJ0110"
                    ],
                    "flexions": [
                        {
                            "var": "oc",
                            "orth": "aimabla",
                            "PoS": [
                                "AJ0210"
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

The facultative parameter

If you want to display only the occitan words of one variety, or if you want to search an occitan word in a particular variety, you can use the "var" parameter which allows, for now, the values : "gascon" (Gascony occitan forms), "lengadoc" (Languedoc occitan forms) o "oc" (forms existing in the two varieties as well).

For instance, if you want to display the Gascony occitan translations of the french word "partir", you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=partir&var=gascon. You get the following result :

{
    "query": [
        {
            "id": 0,
            "forms": [
                {
                    "orth": "partir",
                    "PoS": [
                        "V000050000000"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "partir",
                    "PoS": [
                        "V000050000000"
                    ]
                },
                {
                    "var": "oc",
                    "orth": "anar-se'n",
                    "PoS": [
                        "V000050000000"
                    ]
                }
            ]
        }
    ]
}

If you want to search the french translation of the Languedoc occitan word "cencha", you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=oc&term=cencha&var=lengadoc. You get the following result :

{
    "query": [
        {
            "id": 0,
            "forms": [
                {
                    "orth": "ceinture",
                    "PoS": [
                        "N1210"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "cinta",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc-lengadoc",
                    "orth": "cencha",
                    "PoS": [
                        "N1210"
                    ]
                }
            ]
        },
        {
            "id": 0,
            "forms": [
                {
                    "orth": "taille",
                    "PoS": [
                        "N1210"
                    ]
                }
            ],
            "trads": [
                {
                    "var": "oc",
                    "orth": "talha",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc",
                    "orth": "cinta",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc-lengadoc",
                    "orth": "cencha",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc",
                    "orth": "talha",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc",
                    "orth": "mesura",
                    "PoS": [
                        "N1210"
                    ]
                },
                {
                    "var": "oc-lengadoc",
                    "orth": "pag\u00e8la",
                    "PoS": [
                        "N1210"
                    ]
                }
            ]
        }
    ]
}

Output format

The default output format is JSON. But you can get an XML output in adding "format=xml" to the l'URL.

For instance, if you want to display the translations of the french word "toujours" in XML format, you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=toujours&format=xml. You get the following result :

<query>
    <entry id="12787">
        <form>
            <orth>toujours</orth>
            <PoS>AV0000</PoS>
        </form>
        <trad>
            <var>oc-gascon</var>
            <orth>tostemps</orth>
            <PoS>AV0000</PoS>
        </trad>
        <trad>
            <var>oc-lengadoc</var>
            <orth>totjorn</orth>
            <PoS>AV0000</PoS>
        </trad>
    </entry>
</query>

Las errors

Errors

If there are errors in the input URL or if the query returns no form, the API returns an error with a code and an error text in english. You can see below the error codes with their text :

  • 1 : An API key is required
  • 2 : Invalid API key
  • 3 : Incorrect format ('json' and 'xml' allowed)
  • 4 : A term is required
  • 5 : A language is required
  • 6 : Incorrect language ('oc' and 'fr' allowed)
  • 7 : Incorrect variety ('oc', 'gascon' and 'lengadoc' allowed)
  • 8 : No entry found with your conditions

Output informations

The output you get is a list of entries with an unique ID. For each one, you get :

  • French form(s) : with a spelling and one or more grammatical categories
  • Occitan translation(s) : with the variety ("oc-gascon" for Gascony occitan, "oc-lengadoc" for Languedoc occitan, "oc" for both of them), a spelling and one or more grammatical categories

Grammatical categories are given with Eagles norm. You will find an explanation about the way Lo Congrès uses Eagles norm in the fifth chapter of this document.

JSON schema

{
    "type": "object",
    "properties": {
        "error": {
            "type": "object",
            "properties": {
                "code": {
                    "description": "The unique identifier for an error",
                    "type": "integer"
                },
                "text": {
                    "description": "A description of the error",
                    "type": "string"
                }
            },
            "required": ["code", "text"]
        },
        "query": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "forms": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "orth": {
                                    "type": "string",
                                },
                                "PoS": {
                                    "type": "array",
                                    "items": {
                                        "type":"string"
                                    },
                                    "minItems": 1
                                },
                                "flexions": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "orth": {
                                                "type": "string",
                                            },
                                            "PoS": {
                                                "type": "array",
                                                "items": {
                                                    "type":"string"
                                                },
                                                "minItems": 1
                                            }
                                        },
                                        "required": ["orth", "PoS"]
                                    }
                                }
                            },
                            "required": ["orth", "PoS"]
                        },
                        "minItems": 1
                    },
                    "trads": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "orth": {
                                    "type": "string",
                                },
                                "PoS": {
                                    "type": "array",
                                    "items": {
                                        "type":"string"
                                    },
                                    "minItems": 1
                                },
                                "flexions": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "orth": {
                                                "type": "string",
                                            },
                                            "PoS": {
                                                "type": "array",
                                                "items": {
                                                    "type":"string"
                                                },
                                                "minItems": 1
                                            }
                                        },
                                        "required": ["orth", "PoS"]
                                    }
                                }
                            },
                            "required": ["orth", "PoS"]
                        },
                        "minItems": 1
                    },
                    
                },
                "required": ["id", "forms", "trads"]
            },
            "minItems": 1
        }
    }
}

DTD XML

<! ELEMENT query (entry) >

<! ELEMENT error (#PCDATA) >
<! ATTLIST error code ID #REQUIRED >

<! ELEMENT entry (form+, trad*) >
<! ATTLIST entry id ID #REQUIRED >

<! ELEMENT form (orth, PoS+) >

<! ELEMENT orth (#PCDATA) >

<! ELEMENT PoS (#PCDATA) >

<! ELEMENT trad (orth, PoS+, var) >

<! ELEMENT var (#PCDATA) >

© Lo Congrès Permanent de la Lenga Occitana, 2017, all rights reserved - Contact Lo Congrès