You are here

MPT REST API usage example for shell/curl

cURL is a free software that can be used to fetch content from the web. Thus if you have this software installed on your computer, you can test Connexor Machinese Phrase Tagger web service by typing the following command into the command prompt: curl --data-binary "text=This is a test.&AuthKey=YourAuthenticationKey" http://cxserv2.nlpengine.net/serv/tech/fdg1/en/

The first argument for the curl command denotes that the second argument will contain the POST data in binary format. In the second argument the two obligatory arguments for this webservice are separated by an ampersand. The final command command line argument here is the web service URL, where this HTTP POST query will be sent.

The above command can also be wrapped into simple shell script that will fetch the Machinese Phrase Tagger analysis of the input text given as the command line argument:

#!/bin/sh

curl --data-binary "text=$*&AuthKey=YourAuthenticationKey" http://cxserv2.nlpengine.net/serv/tech/fdg1/fi/

Notes:

  1. Please adjust the authentication key string to match the key assigned to you.
  2. Likewise you may want to adjust the service URLs so that the analyser service matches the language of your input texts.
  3. Your web browser may have rendered the curl command in this script on multiple lines, but the command should be on a single line.