Home Demo Usage

The API is publically available by making GET call to the following URL:


  https://api.ahmado.com/TextClas/ProcessPost.php

the query text should be sent as a parameter named textQuery. Examples below show how to use the API in various environments.

Browser:


  https://api.ahmado.com/TextClas/ProcessPost.php?textQuery=Grab+A+Beer+And+Try+This+Expression+For+Text+Classification

Python:


import requests
url = 'https://api.ahmado.com/TextClas/ProcessPost.php'
params = {"textQuery": "Grab A Beer And Try This Expression For Text Classification"}
resp = requests.get(url=url, params=params)
data = resp.json()
print data

Command line - curl:

  $ curl -H "Accept: application/json" -v "https://api.ahmado.com/TextClas/ProcessPost.php?textQuery=Grab+A+Beer+And+Try+This+Expression+For+Event+Extraction"
  *   Trying 69.163.226.197...
  * Connected to api.ahmado.com (69.163.226.197) port 443 (#0)
  * found 148 certificates in /etc/ssl/certs/ca-certificates.crt
  * found 594 certificates in /etc/ssl/certs
  * ALPN, offering http/1.1
  * SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
  *        server certificate verification OK
  *        server certificate status verification SKIPPED
  *        common name: api.ahmado.com (matched)
  *        server certificate expiration date OK
  *        server certificate activation date OK
  *        certificate public key: RSA
  *        certificate version: #3
  *        subject: CN=api.ahmado.com
  *        start date: Tue, 28 May 2019 14:59:06 GMT
  *        expire date: Mon, 26 Aug 2019 14:59:06 GMT
  *        issuer: C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3
  *        compression: NULL
  * ALPN, server accepted to use http/1.1
  > GET /TextClas/ProcessPost.php?textQuery=Grab+A+Beer+Try+This+Expression+For+Event+Extraction HTTP/1.1
  > Host: api.ahmado.com
  > User-Agent: curl/7.47.0
  > Accept: application/json
  >
  < HTTP/1.1 200 OK
  < Date: Mon, 10 Jun 2019 01:34:40 GMT
  < Server: Apache
  < Upgrade: h2
  < Connection: Upgrade
  < Transfer-Encoding: chunked
  < Content-Type: application/json
  <
  {"categories":[{"prob":0.6,"topic":"drink"},{"prob":0.16,"topic":"contest"},{"prob":0.09,"topic":"show"},{"prob":0.06,"topic":"food"}],"query":"Grab A Beer Try This Expression For Event Extraction"}
  * Connection #0 to host api.ahmado.com left intact

Javascript/jQuery:


  $.ajax({
      contentType : "application/json; charset=utf-8",
      type: "GET",
      dataType: "json",
      url: "https://api.ahmado.com/TextClas/ProcessPost.php",
      data: {textQuery: "Grab A Beer And Try This Expression For Event Extraction"},
      success: function(result) {
          console.log("Completed");
          console.log(result);
      },
      error: function(error) {
          console.log("Failed");
          console.log(error);
      }
  });


Back to NLP-as-a-Service APIs