[
  {
    "lines": [
      "## Dictionary", 
      "", 
      "SignPuddle 3 organizes user dictionary elements into dictionary collections.", 
      "Dictionary collections are available in three different forms: database, plain text files, and JSON objects", 
      "", 
      "### Databases", 
      "", 
      "Each collection is available as an SQLite database.", 
      "These databases are the primary source and all edits are directly applied to the database.", 
      "", 
      "table entry  ", 
      "+ id  ", 
      "+ sign  ", 
      "+ terms  ", 
      "+ lower  ", 
      "+ signtext  ", 
      "+ text  ", 
      "+ source  ", 
      "+ detail  ", 
      "+ user  ", 
      "+ created_at  ", 
      "+ updated_at  ", 
      "", 
      "### Plain Text Files", 
      "", 
      "Each collection is available as a plain text field where each entry occupies its own line.", 
      "Each entry contains multiple fields that are divided by tab characters.", 
      "The plain text files are designed for easy import and export from the databases.", 
      "", 
      "id /t sign /t terms /t lower /t signtext /t text /t source /t detail /t user /t updated_at", 
      "", 
      "### JSON Data files", 
      "", 
      "The dictionary JSON data file is an object.", 
      "Each key contains an object with three properties: message, description, icon, and updated_at.", 
      "", 
      "{  ", 
      "  \"name\": \"xml-MY-dictionary-public\",  ", 
      "  \"data\": [  ", 
      "    {  ", 
      "      \"id\": \"2\",  ", 
      "      \"sign\": \"\\ud836\\udc03\\ud836\\udd44\\ud836\\udd19\\ud8ef\\udfa1\\ud836\\udcf4\\ud836\\udcf4\\ud8dd\\udc54\\ud836\\udcc8\\ud836\\udcfc\\ud8dd\\udc42\\ud836\\udd26\\ud836\\udcfa\\ud8c8\\uddd2\\ud836\\udd15\\ud836\\udcee\\ud8c8\\uddda\\ud836\\udce0\\ud836\\udcef\",  ", 
      "      \"terms\": [  ", 
      "        \"Malaysia\"  ", 
      "      ],  ", 
      "      \"lower\": [  ", 
      "        \"malaysia\"  ", 
      "      ],  ", 
      "      \"signtext\": \"\",  ", 
      "      \"text\": \"\",  ", 
      "      \"source\": \"Conference Maastricht\",  ", 
      "      \"detail\": {},  ", 
      "      \"user\": \"admin\",  ", 
      "      \"created_at\": \"2007-03-29T19:09:37Z\",  ", 
      "      \"updated_at\": \"2007-03-29T19:09:37Z\"  ", 
      "    }  ", 
      "  ]  ", 
      "}  ", 
      ""
    ], 
    "host": "https://signpuddle.com/server", 
    "meta": "Generated from ApiTxt format (output/dictionary.txt) using txt2json.py", 
    "root": "dictionary", 
    "title": "SignPuddle 3 Dictionary API"
  }, 
  {
    "lines": [
      "+ Source: [ApiTxt format](../src/dictionary.txt) and [JSON objects](../src/dictionary.json)", 
      "+ Documents: [API Blueprint](../doc/dictionary.md) and [Stand Alone HTML](../doc/dictionary.htm)", 
      "+ Live Page: [API Dictionary](../api/dictionary.html) and [JavaScript](../api/dictionary.js)"
    ], 
    "group": "dictionary", 
    "description": "Resources related to dictionary collections"
  }, 
  {
    "route": "/dictionary{?name}", 
    "name": "Dictionaries available", 
    "parameters": [
      {
        "description": "partial dictionary name", 
        "type": "string", 
        "name": "name", 
        "example": "public"
      }
    ]
  }, 
  {
    "code": [
      "$dir = 'data/db/';", 
      "$ext = '.db';", 
      "$out = [];", 
      "if ($name){", 
      "  if (strpos($name,\"dictionary\")!==false){", 
      "    $dictionaries = $dir . '*' . $name . '*' . $ext;", 
      "    $files = glob($dictionaries);", 
      "  } else {", 
      "    $dictionaries = $dir . '*dictionary*' . $name . '*' . $ext;", 
      "    $files = glob($dictionaries);", 
      "    if (count($files)==0) {", 
      "      $dictionaries = $dir . '*' . $name . '*dictionary*' . $ext;", 
      "      $files = glob($dictionaries);", 
      "    }", 
      "  }", 
      "} else {", 
      "  $dictionaries = $dir . '*dictionary*' . $ext;", 
      "  $files = glob($dictionaries);", 
      "}", 
      "foreach ($files as $filename) {", 
      "  $out[] = str_replace($ext,'',str_replace($dir,'',$filename));", 
      "}", 
      "if (count($out)){", 
      "  echo json_pretty($out);", 
      "} else {", 
      "  $app->response->setStatus(204);", 
      "}", 
      "return;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "responses": [
          {
            "status": 200, 
            "body": [
              "[\"ase-US-dictionary-public\"]"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "Get available dictionaries"
  }, 
  {
    "route": "/dictionary/{name}{?update}", 
    "name": "Dictionary resource", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "Forces a rewrite of the dictionary for json and txt formats", 
        "type": "optional,number", 
        "name": "update", 
        "example": "1"
      }
    ], 
    "description": "Access to available dictionaries"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "if (strpos($name,'.')){", 
      "  $parts = explode('.',$name);", 
      "  $name = $parts[0];", 
      "  $format = $parts[1];", 
      "  if (!in_array($format,['db','txt','json'])){", 
      "    haltNotFound();", 
      "  }", 
      "} else {", 
      "  $format = 'json';", 
      "}", 
      "$dir = 'data/' . $format . '/';", 
      "$ext = '.' . $format;", 
      "$file = $dir . $name . $ext;", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check  && !$update){", 
      "  haltNotModified();", 
      "}", 
      "if ($format=='json' && (!file_exists($file) || $update)) {", 
      "  $json = dictionary2json($name);", 
      "  file_put_contents($file,$json);", 
      "} else if ($format=='txt' && (!file_exists($file) || $update)) {", 
      "  $txt = dictionary2txt($name);", 
      "  file_put_contents($file,$txt);", 
      "}", 
      "if(file_exists($file)) {", 
      "  header('Last-Modified: ' . $lastModified);", 
      "  $searchTime = searchtime($timein);", 
      "  header(\"Search-Time: \" . $searchTime);", 
      "  getFile($file);", 
      "} else {", 
      "  haltNotFound();", 
      "}"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary text"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "1\t\ud836\udc00\ud8cb\udc61\ud8c8\uddd9\ud8db\udfc3\ud836\udc03\ud836\udd1d\ud836\udd14\ud8c8\uddd9\ud836\udcf0\ud836\udcf9\ud8db\udfc3\ud836\udd0e\ud836\udd01\ud8cb\udc61\ud836\udcfd\ud836\udd00\ttest zero\ttest zero\twe are testing SignPuddle 1.6\tVal ;-)\t{\"video\":\"<iframe width=\\\"425\\\" height=\\\"349\\\" src=\\\"http:\\/\\/www.youtube.com\\/embed\\/RTniYA1lTDM\\\" frameborder=\\\"0\\\" allowfullscreen><\\/iframe>\"}\tVal\t2011-07-20T17:39:02Z\t2011-07-20T17:42:09Z"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary"
  }, 
  {
    "route": "/dictionary/{name}/signs", 
    "name": "List of dictionary signs", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }
    ], 
    "description": "The signs in the dictionary"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "header('Last-Modified: ' . $lastModified);", 
      "$output = dictionarySigns($name);", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary text"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "\ud836\udc00\ud8cb\udc61\ud8c8\uddd9\ud8db\udfc3\ud836\udc03\ud836\udd1d\ud836\udd14\ud8c8\uddd9\ud836\udcf0\ud836\udcf9\ud8db\udfc3\ud836\udd0e\ud836\udd01\ud8cb\udc61\ud836\udcfd\ud836\udd00"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary signs"
  }, 
  {
    "route": "/dictionary/{name}/signtexts", 
    "name": "List of dictionary signtexts", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }
    ], 
    "description": "The signtexts in the dictionary"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "header('Last-Modified: ' . $lastModified);", 
      "$output = dictionarySigntexts($name);", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary text"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "\ud836\udc00\ud8cb\udc61\ud8c8\uddd9\ud8db\udfc3\ud836\udc03\ud836\udd1d\ud836\udd14\ud8c8\uddd9\ud836\udcf0\ud836\udcf9\ud8db\udfc3\ud836\udd0e\ud836\udd01\ud8cb\udc61\ud836\udcfd\ud836\udd00"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary signtexts"
  }, 
  {
    "route": "/dictionary/{name}/entry", 
    "name": "Dictionary entry resource", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }
    ], 
    "description": "Entries for dictionary"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$data = $app->request->getbody();", 
      "$data = json_decode($data,true);", 
      "echo dictionaryEntryNew($name,$data,$pass);", 
      "$app->response->setStatus(201);", 
      "return;"
    ], 
    "method": "POST", 
    "dialog": [
      {
        "request": {
          "body": [
            "{", 
            "  \"sign\": \"\\ud836\\udc03\\ud836\\udd44\\ud836\\udd19\\ud8ef\\udfa1\\ud836\\udcf4\\ud836\\udcf4\\ud8dd\\udc54\\ud836\\udcc8\\ud836\\udcfc\\ud8dd\\udc42\\ud836\\udd26\\ud836\\udcfa\\ud8c8\\uddd2\\ud836\\udd15\\ud836\\udcee\\ud8c8\\uddda\\ud836\\udce0\\ud836\\udcef\",", 
            "  \"terms\": [", 
            "    \"Malaysia\"", 
            "  ],", 
            "  \"signtext\": \"\",", 
            "  \"text\": \"\",", 
            "  \"source\": \"Conference Maastricht\",", 
            "  \"detail\": {}", 
            "}  "
          ], 
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9"
          }, 
          "type": "application/json", 
          "name": "add new dictionary entry"
        }, 
        "responses": [
          {
            "status": 201, 
            "body": [
              "777"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "add dictionary entry"
  }, 
  {
    "route": "/dictionary/{name}/entry/{id}", 
    "name": "Dictionary entry resource for id", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "An id numbers", 
        "type": "string", 
        "name": "id", 
        "example": "11244"
      }
    ], 
    "description": "Specific entries for dictionary"
  }, 
  {
    "code": [
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "$data = $app->request->getbody();", 
      "$data = json_decode($data,true);", 
      "dictionaryEntryUpdate($name,$id,$data,$pass);", 
      "$app->response->setStatus(204);", 
      "return;"
    ], 
    "method": "PUT", 
    "dialog": [
      {
        "request": {
          "body": [
            "{", 
            "  \"sign\": \"\\ud836\\udc03\\ud836\\udd44\\ud836\\udd19\\ud8ef\\udfa1\\ud836\\udcf4\\ud836\\udcf4\\ud8dd\\udc54\\ud836\\udcc8\\ud836\\udcfc\\ud8dd\\udc42\\ud836\\udd26\\ud836\\udcfa\\ud8c8\\uddd2\\ud836\\udd15\\ud836\\udcee\\ud8c8\\uddda\\ud836\\udce0\\ud836\\udcef\",", 
            "  \"terms\": [", 
            "    \"Malaysia\"", 
            "  ],", 
            "  \"signtext\": \"\",", 
            "  \"text\": \"\",", 
            "  \"source\": \"Conference Maastricht\",", 
            "  \"detail\": {}", 
            "}  "
          ], 
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9"
          }, 
          "type": "application/json", 
          "name": "an update for an existing dictionary entry"
        }, 
        "responses": [
          {
            "status": 204
          }
        ]
      }
    ], 
    "name": "update dictionary entry"
  }, 
  {
    "code": [
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "dictionaryEntryDelete($name,$id,$pass);", 
      "$app->response->setStatus(204);"
    ], 
    "method": "DELETE", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9"
          }, 
          "name": "the removal of an dictionary entry"
        }, 
        "responses": [
          {
            "status": 204
          }
        ]
      }
    ], 
    "name": "remove dictionary entry"
  }, 
  {
    "route": "/dictionary/{name}/search{?offset,limit,filter,sort,results}", 
    "name": "Search dictionary", 
    "parameters": [
      {
        "description": "The name of a dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "Start of search results", 
        "type": "number", 
        "name": "offset", 
        "example": "0"
      }, 
      {
        "description": "Number of search results", 
        "type": "number", 
        "name": "limit", 
        "example": "10"
      }, 
      {
        "description": "restrict search results", 
        "type": "string", 
        "name": "filter", 
        "example": "user=Val"
      }, 
      {
        "description": "Field for sorting results", 
        "type": "string", 
        "name": "sort", 
        "example": "created_at"
      }, 
      {
        "description": "Type of results: entries, sign, term, terms", 
        "type": "string", 
        "name": "results", 
        "example": "sign"
      }
    ], 
    "description": "Searching dictionary signs"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "$output = json_pretty(dictionarySearch($name,$offset,$limit,$filter,$sort,$results));", 
      "header('Last-Modified: ' . $lastModified);", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9", 
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary query results"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "{", 
              "  \"total\": 1,", 
              "  \"data\": [", 
              "    [", 
              "      \"1\",", 
              "      \"\\ud836\\udc00\\ud8cb\\udc61\\ud8c8\\uddd9\\ud8db\\udfc3\\ud836\\udc03\\ud836\\udd1d\\ud836\\udd14\\ud8c8\\uddd9\\ud836\\udcf0\\ud836\\udcf9\\ud8db\\udfc3\\ud836\\udd0e\\ud836\\udd01\\ud8cb\\udc61\\ud836\\udcfd\\ud836\\udd00\"", 
              "    ]", 
              "  ]", 
              "}"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary results of searching"
  }, 
  {
    "route": "/dictionary/{name}/search/id/{id}{?offset,limit,filter,sort,results}", 
    "name": "Search dictionary with ids", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "A list of one or more id numbers", 
        "type": "string", 
        "name": "id", 
        "example": "1-4,5"
      }, 
      {
        "description": "Start of search results", 
        "type": "number", 
        "name": "offset", 
        "example": "0"
      }, 
      {
        "description": "Number of search results", 
        "type": "number", 
        "name": "limit", 
        "example": "10"
      }, 
      {
        "description": "restrict search results", 
        "type": "string", 
        "name": "filter", 
        "example": "user=Val"
      }, 
      {
        "description": "Field for sorting results", 
        "type": "string", 
        "name": "sort", 
        "example": "created_at"
      }, 
      {
        "description": "Type of results: entries, sign, term, terms", 
        "type": "string", 
        "name": "results", 
        "example": "sign"
      }
    ], 
    "description": "Specific entries for dictionary"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "$output = json_pretty(dictionarySearchId($name,$id,$offset,$limit,$filter,$sort,$results));", 
      "header('Last-Modified: ' . $lastModified);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9", 
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "an dictionary entry"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "[", 
              "  {", 
              "    \"id\": \"1\",", 
              "    \"sign\": \"\\ud836\\udc00\\ud8cb\\udc61\\ud8c8\\uddd9\\ud8db\\udfc3\\ud836\\udc03\\ud836\\udd1d\\ud836\\udd14\\ud8c8\\uddd9\\ud836\\udcf0\\ud836\\udcf9\\ud8db\\udfc3\\ud836\\udd0e\\ud836\\udd01\\ud8cb\\udc61\\ud836\\udcfd\\ud836\\udd00\",", 
              "    \"terms\": [", 
              "      \"test zero\"", 
              "    ],", 
              "    \"lower\": [", 
              "      \"test zero\"", 
              "    ],", 
              "    \"signtext\": \"\",", 
              "    \"text\": \"we are testing SignPuddle 1.6\",", 
              "    \"source\": \"Val ;-)\",", 
              "    \"detail\": {", 
              "      \"video\": \"<iframe width=\\\"425\\\" height=\\\"349\\\" src=\\\"http:\\/\\/www.youtube.com\\/embed\\/RTniYA1lTDM\\\" frameborder=\\\"0\\\" allowfullscreen><\\/iframe>\"", 
              "    },", 
              "    \"user\": \"Val\",", 
              "    \"created_at\": \"2011-07-20T17:39:02Z\",", 
              "    \"updated_at\": \"2011-07-20T17:42:09Z\"", 
              "  }", 
              "]"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary entry"
  }, 
  {
    "route": "/dictionary/{name}/search/sign/{query}{?offset,limit,filter,sort,results}", 
    "name": "Search signs with query string", 
    "parameters": [
      {
        "description": "The name of a dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "A query string", 
        "type": "required,string", 
        "name": "query", 
        "example": "Q"
      }, 
      {
        "description": "Start of search results", 
        "type": "number", 
        "name": "offset", 
        "example": "0"
      }, 
      {
        "description": "Number of search results", 
        "type": "number", 
        "name": "limit", 
        "example": "10"
      }, 
      {
        "description": "restrict search results", 
        "type": "string", 
        "name": "filter", 
        "example": "user=Val"
      }, 
      {
        "description": "Field for sorting results", 
        "type": "string", 
        "name": "sort", 
        "example": "created_at"
      }, 
      {
        "description": "Type of results: entries, sign, term, terms", 
        "type": "string", 
        "name": "results", 
        "example": "sign"
      }
    ], 
    "description": "Query string access to dictionary signs"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "header('Last-Modified: ' . $lastModified);", 
      "$output = json_pretty(dictionarySearchSign($name,$query,$offset,$limit,$filter,$sort,$results));", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9", 
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary query results"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "{", 
              "  \"total\": 1,", 
              "  \"data\": [", 
              "    [", 
              "      \"1\",", 
              "      \"\\ud836\\udc00\\ud8cb\\udc61\\ud8c8\\uddd9\\ud8db\\udfc3\\ud836\\udc03\\ud836\\udd1d\\ud836\\udd14\\ud8c8\\uddd9\\ud836\\udcf0\\ud836\\udcf9\\ud8db\\udfc3\\ud836\\udd0e\\ud836\\udd01\\ud8cb\\udc61\\ud836\\udcfd\\ud836\\udd00\"", 
              "    ]", 
              "  ]", 
              "}"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary results of searching signs with query string"
  }, 
  {
    "route": "/dictionary/{name}/search/signtext/{query}{?offset,limit,filter,sort,results}", 
    "name": "Search signtexts with query string", 
    "parameters": [
      {
        "description": "The name of a dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "A query string", 
        "type": "required,string", 
        "name": "query", 
        "example": "Q"
      }, 
      {
        "description": "Start of search results", 
        "type": "number", 
        "name": "offset", 
        "example": "0"
      }, 
      {
        "description": "Number of search results", 
        "type": "number", 
        "name": "limit", 
        "example": "10"
      }, 
      {
        "description": "restrict search results", 
        "type": "string", 
        "name": "filter", 
        "example": "user=Val"
      }, 
      {
        "description": "Field for sorting results", 
        "type": "string", 
        "name": "sort", 
        "example": "created_at"
      }, 
      {
        "description": "Type of results: entries, signtext, term, terms", 
        "type": "string", 
        "name": "results", 
        "example": "sign"
      }
    ], 
    "description": "Query string access to dictionary signtexts"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check){", 
      "  haltNotModified();", 
      "}", 
      "header('Last-Modified: ' . $lastModified);", 
      "$output = json_pretty(dictionarySearchSigntext($name,$query,$offset,$limit,$filter,$sort,$results));", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9", 
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary query results"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "{", 
              "  \"total\": 1,", 
              "  \"data\": [", 
              "    [", 
              "      \"1\",", 
              "      \"\\ud836\\udc00\\ud8cb\\udc61\\ud8c8\\uddd9\\ud8db\\udfc3\\ud836\\udc03\\ud836\\udd1d\\ud836\\udd14\\ud8c8\\uddd9\\ud836\\udcf0\\ud836\\udcf9\\ud8db\\udfc3\\ud836\\udd0e\\ud836\\udd01\\ud8cb\\udc61\\ud836\\udcfd\\ud836\\udd00\"", 
              "    ]", 
              "  ]", 
              "}"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve dictionary results of searching signtexts with query string"
  }, 
  {
    "route": "/dictionary/{name}/search/terms/{text}{?type,case,offset,limit,filter,sort,results}", 
    "name": "Dictionary terms search", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "The text for searching", 
        "type": "required,string", 
        "name": "text", 
        "example": "`SignPuddle`"
      }, 
      {
        "description": "Type of search of start, end, or exact", 
        "type": "string", 
        "name": "type", 
        "example": "exact"
      }, 
      {
        "description": "Case sensitive search", 
        "type": "number", 
        "name": "case", 
        "example": "0"
      }, 
      {
        "description": "Start of search results", 
        "type": "number", 
        "name": "offset", 
        "example": "0"
      }, 
      {
        "description": "Number of search results", 
        "type": "number", 
        "name": "limit", 
        "example": "10"
      }, 
      {
        "description": "restrict search results", 
        "type": "string", 
        "name": "filter", 
        "example": "user=Val"
      }, 
      {
        "description": "Field for sorting results", 
        "type": "string", 
        "name": "sort", 
        "example": "created_at"
      }, 
      {
        "description": "Type of results: entries, sign, term, terms", 
        "type": "string", 
        "name": "results", 
        "example": "sign"
      }
    ], 
    "description": "Search dictionary terms for text"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$output = json_pretty(dictionarySearchTerms($name,$text,$type,$case, $offset, $limit, $filter, $sort,$results));", 
      "$searchTime = searchtime($timein);", 
      "header(\"Search-Time: \" . $searchTime);", 
      "echo $output;"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9"
          }, 
          "name": "matching dictionary entries"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "{", 
              "  \"total\": 1,", 
              "  \"data\": [", 
              "    [", 
              "      \"1\",", 
              "      \"\\ud836\\udc00\\ud8cb\\udc61\\ud8c8\\uddd9\\ud8db\\udfc3\\ud836\\udc03\\ud836\\udd1d\\ud836\\udd14\\ud8c8\\uddd9\\ud836\\udcf0\\ud836\\udcf9\\ud8db\\udfc3\\ud836\\udd0e\\ud836\\udd01\\ud8cb\\udc61\\ud836\\udcfd\\ud836\\udd00\"", 
              "    ]", 
              "  ]", 
              "}"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "retrieve matching entries"
  }, 
  {
    "route": "/dictionary/{name}/alphabet{?update}", 
    "name": "Dictionary symbol subset", 
    "parameters": [
      {
        "description": "The name of an dictionary", 
        "type": "required,string", 
        "name": "name", 
        "example": "`ase-US-dictionary-public`"
      }, 
      {
        "description": "Forces a rewrite of the alphabet", 
        "type": "optional,number", 
        "name": "update", 
        "example": "1"
      }
    ], 
    "description": "Create alphabet from dictionary signs"
  }, 
  {
    "code": [
      "$headers = getHeaders();", 
      "$pass = isset($headers['Pass'])?$headers['Pass']:'';", 
      "rightsCheck($name,$pass,SP_VIEW);", 
      "$check = isset($headers['If-Modified-Since'])?$headers['If-Modified-Since']:'';", 
      "if ($name==\"iswa-2010\"){", 
      "  echo json_pretty(dictionaryISWA());", 
      "  return;", 
      "}", 
      "$err = invalidName($name);", 
      "if ($err){", 
      "  haltBadRequest($err);", 
      "}", 
      "$lastModified = lastModified($name);", 
      "if ($lastModified <= $check  && !$update){", 
      "  haltNotModified();", 
      "}", 
      "", 
      "$alphabet = str_replace('-dictionary-','-alphabet-',$name);", 
      "$file = 'data/json/' . $alphabet . '.json';", 
      "if (!$update){", 
      "  if (!file_exists($file)) {", 
      "    $update = 1;", 
      "  } else {", 
      "    $check = date (\"Y-m-d\\TH:i:s\", filemtime($file));", 
      "    $check =  new DateTime($check);", 
      "    $check->setTimezone(new DateTimeZone('UTC'));", 
      "    $check = $check->format('Y-m-d\\TH:i:s\\Z');", 
      "    if ($lastModified>$check){", 
      "      $update = 1;", 
      "    }", 
      "  }", 
      "}", 
      "if ($update) {", 
      "  $json = json_pretty(dictionaryAlphabet($name,$lastModified));", 
      "  file_put_contents($file,$json);", 
      "}", 
      "if(file_exists($file)) {", 
      "  header('Last-Modified: ' . $lastModified);", 
      "  $searchTime = searchtime($timein);", 
      "  header(\"Search-Time: \" . $searchTime);", 
      "  getFile($file);", 
      "} else {", 
      "  haltNotFound();", 
      "}"
    ], 
    "method": "GET", 
    "dialog": [
      {
        "request": {
          "headers": {
            "Pass": "724fd4b4438fba9d0c5ab89d0833e5c9", 
            "If-Modified-Since": "2019-01-16T16:56:19.175Z"
          }, 
          "name": "dictionary query results"
        }, 
        "responses": [
          {
            "status": 200, 
            "body": [
              "{\"name\": \"ase-US-alphabet-public\",\"data\": []}"
            ], 
            "type": "text/plain"
          }
        ]
      }
    ], 
    "name": "generate alphabet from dictionary contents"
  }
]
