API & modules

API sembla-mots - Notice

The sembla-mots API generates words which seem occitan but which doesn't exists in occitan.

Input URL

The application basic URL is http://api.locongres.org/semblamots.php. You have to add mandatory parameters and you can add facultative parameters. 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.
  • Pseudoword length : you have to specify the length you want the pseudoword to have with the "length" parameter. It must be between 4 and 8.
  • Variety : you have to specify in which occitan variety you want to search words with the "var" parameter. For the moment, its allows the values "gascon" (for Gascony occitan) and "lengadoc" (for Languedoc occitan).

For instance, if you want to generate a 5-letters pseudoword in lengadocian occitan, you have to use the URL http://api.locongres.org/semblamots.php?key=[la_vòsta_clau_API]&length=5&var=lengadoc. You get the following result :

{
    "query": [
        {
            "entar",
        }
    ]
}

Facultative parameters

The first character

You can specify the first character you want the pseudoword to have with the "firstchar" parameter. Its value must be an occitan letter without diacritical sign.

For instance, if you want to generate a pseudoword with 6 letters in Gascony occitan which begins with an "a", you have to use the URL http://api.locongres.org/semblamots.php?key=[la_vòsta_clau_API]&length=6&var=gascon&firstchar=a. You get the following result :

{
    "query": [
        {
            "aconas",
        }
    ]
}

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 generate a pseudoword with 8 letters in Gascony occitan in XML format, you can use the URL http://api.locongres.org/semblamots.php?key=[la_vòsta_clau_API]&length=8&var=gascon&format=xml. You get the following result :

<query>
    <pseudoword id="1">lassasta</pseudoword>
</query>

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 length is required
  • 5 : A variety is required
  • 6 : Incorrect variety ("gascon" and "lengadoc" allowed)
  • 7 : The length of the non-words must be between 4 and 8
  • 8 : No pseudoword found with your conditions

Output informations

The output you get is a pseudoword.

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": "string"
            },
            "minItems": 1,,
            "maxItems": 1
        }
    }
}

DTD XML

<! ELEMENT query (nonmot) >

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

<! ELEMENT nonmot (#PCDATA) >
<! ATTLIST nonmot id ID #REQUIRED >

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