The skrutable server can also be queried programmatically with four API endpoints:
These endpoints accept POST requests only.
Below are examples of how to use these endpoints. The input format options shown for the first endpoint also apply to the others.
endpoint URL | example single-line request with cURL | example multi-line (whole-file) request with cURL | example single-line request with Python | example multi-line (whole-file) request with Python |
---|---|---|---|---|
.../api/transliterate | curl $ENDPOINT_URL \ -F input_text=udāharaṇam \ -F from_scheme=IAST \ -F to_scheme=HK or curl $ENDPOINT_URL -d "{ "input_text":"udāharaṇam", "from_scheme":"IAST", "to_scheme":"HK" }" \ -H "Content-Type: application/json" | curl $ENDPOINT_URL \ -F input_file=@/path/to/file \ -F from_scheme=IAST \ -F to_scheme=HK | result = requests.post( ENDPOINT_URL, data={ "input_text": "udāharaṇam", "from_scheme": "IAST", "to_scheme": "HK" }).text or result = requests.post( ENDPOINT_URL, json={ "input_text": "udāharaṇam", "from_scheme": "IAST", "to_scheme": "HK" }).text | result = requests.post( ENDPOINT_URL, data={ "input_text": open("path/to/file", "rb"), "from_scheme": "IAST", "to_scheme": "HK" }).text or result = requests.post( ENDPOINT_URL, files={ "input_file": open("path/to/file", "rb") }, data={ "from_scheme": "IAST", "to_scheme": "HK" }).text |
.../api/scan | curl $ENDPOINT_URL \ -F input_text="dharmakṣetre kurukṣetre" \ -F from_scheme=IAST \ -F to_scheme=HK \ -F show_weights=true \ -F show_morae=true \ -F show_gaRas=true \ -F show_alignment=true | curl $ENDPOINT_URL \ -F input_file=@/path/to/file \ -F from_scheme=IAST \ -F to_scheme=HK \ -F show_weights=true \ -F show_morae=true \ -F show_gaRas=true \ -F show_alignment=true | result = requests.post( ENDPOINT_URL, data={ "input_text": "udāharaṇam", "from_scheme": "IAST", "to_scheme": "HK", "show_weights": True, "show_morae": True, "show_gaRas": True, "show_alignment": True }).text | result = requests.post( ENDPOINT_URL, data={ "input_text": open("path/to/file", "rb"), "from_scheme": "IAST", "to_scheme": "HK", "show_weights": True, "show_morae": True, "show_gaRas": True, "show_alignment": True }).text |
.../api/identify-meter | curl $ENDPOINT_URL \ -F input_text="dharmakṣetre kurukṣetre samavetāḥ yuyutsavaḥ" \ -F from_scheme=IAST \ -F to_scheme=HK \ -F show_weights=true \ -F show_morae=true \ -F show_gaRas=true \ -F show_alignment=true \ -F resplit_option=resplit_lite_keep_mid | curl $ENDPOINT_URL \ -F input_file=@/path/to/file \ -F from_scheme=IAST \ -F to_scheme=HK \ -F show_weights=true \ -F show_morae=true \ -F show_gaRas=true \ -F show_alignment=true \ -F resplit_option=resplit_lite_keep_mid | result = requests.post( ENDPOINT_URL, data={ "input_text": "udāharaṇam", "from_scheme": "IAST", "to_scheme": "HK", "show_weights": True, "show_morae": True, "show_gaRas": True, "show_alignment": True, "resplit_option": "resplit_lite_keep_mid" }).text | result = requests.post( ENDPOINT_URL, data={ "input_text": open("path/to/file", "rb"), "from_scheme": "IAST", "to_scheme": "HK", "show_weights": True, "show_morae": True, "show_gaRas": True, "show_alignment": True, "resplit_option": "resplit_lite_keep_mid" }).text |
.../api/split | curl $ENDPOINT_URL \ -F input_text=tathodāharaṇam \ -F from_scheme=IAST \ -F to_scheme=HK | curl $ENDPOINT_URL \ -F input_file=@/path/to/file \ -F from_scheme=IAST \ -F to_scheme=HK | result = requests.post( ENDPOINT_URL, data={ "input_text": "tathodāharaṇam", "from_scheme": "IAST", "to_scheme": "HK" }).text | result = requests.post( ENDPOINT_URL, data={ "input_text": open("path/to/file", "rb"), "from_scheme": "IAST", "to_scheme": "HK" }).text |
You can of course also use any other technology for making POST requests that you prefer.