Using the API |
Top Previous Next |
The CTexT NCHLT Web Services can be accessed via a RESTful API.
Step 1:
Generate a valid session ID using the following POST call:
http://{server:port}/CTexTWebAPI/services/setuser
When making this API call, the request header must contain the following property:
Key: Authorization Value: Basic aGVsZW4ncyBzdGludCBhcyBsZWFndWUgbWFuYWdlcg==
The response will be a JSON object containing a string array labeled token.
Example of reponse:
{"token":["4E3EDB46C33517701FC18F540FEBD5EE"]}
Step 2:
The API can then be called using a GET call and should always consist of the following information:
http://{server:port}/CTexTWebAPI/services?core={technology}&lang={code}&text={text}
Where the following is required:
Examples:
http://127.0.0.1:8080/CTexTWebAPI/services?core=pos&lang=AF&text=teks+om+te+toets http://v-ctx-lnx7.nwu.ac.za:8080/CTexTWebAPI/services?core=2&lang=EN&text=helen's+stint+as+league+manager
API parameter values:
Files can also be uploaded for processing (as long as they are smaller than 20Mb), through the curl tools or a multi-part form data, such as using curl. A valid authToken must be included in the request header. An example of this would be:
curl -F "file=@C:\Users\user\Desktop\Temp\Test.jpg" --form language=af --form core=ocr -X POST http://127.0.0.1:8080/CTexTWebAPI/services/file
|