Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API suggestions #6

Closed
drdhaval2785 opened this issue Dec 16, 2017 · 9 comments
Closed

API suggestions #6

drdhaval2785 opened this issue Dec 16, 2017 · 9 comments

Comments

@drdhaval2785
Copy link
Owner

drdhaval2785 commented Dec 16, 2017

As per @vvasuki

  1. You'd be following REST API conventions (google it) better and it would be clearer if the URI were http://api.sanskritworld.in/v0.0.1/tinantas/slp1/jagAma/prakriya

  2. And you might have the API automatically produce the output in a desired encoding with query parameters of the type:
    http://api.sanskritworld.in/v0.0.1/tinantas/slp1/jagAma/prakriya?encoding=devanaagarii

  3. Further, you might want to publish the swagger API documentation (Example https://api.vedavaapi.org/scala/swagger/index.html#/grammarv1analyser/Analyse1 or https://api.vedavaapi.org/py/ullekhanam/docs#!/default/get_book_list ) for your API - just use flask-restplus library.

@drdhaval2785
Copy link
Owner Author

@vvasuki

The flask_restplus application is working locally.
I tried running it on apache2 server.
It seems that I am missing something.
Can you help me in deploying it?

https://github.com/drdhaval2785/prakriya/blob/master/yourapplication.wsgi is the wsgi file
https://github.com/drdhaval2785/prakriya/blob/master/dhatu_restplus.py is the restplus app.

@drdhaval2785
Copy link
Owner Author

Regarding point 2, I would leave it to the client side to do the transliteration.

@vvasuki
Copy link
Collaborator

vvasuki commented Dec 16, 2017

What was the problem? log kim avadat?

https://github.com/kmadathil/sanskrit_parser/tree/master/wsgi ityapi pashyatu.

You need to enable wsgi module, and enable the wsgi configuration

@drdhaval2785
Copy link
Owner Author

Point 3 done.
It was a problem of not restarting apache after changes in app.
Resolved now.

@drdhaval2785
Copy link
Owner Author

http://api.sanskritworld.in/#/default is where the swagger documentation of API is available.

@drdhaval2785
Copy link
Owner Author

Point 1 and 2, I am not so sure whether they are more intuitive.
I will wait for user feedback.
After swagger documentation, things looks quite simple.
Thanks @vvasuki for drawing my attention to flask-restplus and swagger.
This is my first python API.

screenshot from 2017-12-16 13-13-14

@vvasuki
Copy link
Collaborator

vvasuki commented Dec 16, 2017

Looks great!

Regarding point 1

Now, I don't know and have to guess what the expected encoding is. should I type gacCati or gachChati or gacCawi etc..? Now, that's where
http://api.sanskritworld.in/v0.0.1/tinantas/slp1/jagAma/prakriya?encoding=devanaagarii would make it crystal clear. It tells you the following:

  • We're asking for tinanta (not subanta) prakriya-s. So don't interpret gacCanti as shatranta-bahuvachana.
  • We're expected to give our input in SLP1 (you can leave this as a fixed expectation - I'm not suggesting that you make this part flexible).

Please note that REST API consumers in general are used to some conventions and best practices, which have been generally accepted for a reason. One should be wary of disregarding it without good reason (in other words, you should by default follow the convention, and expect users to demand that you don't rather than the other way round.)

Regarding point 2.

Regarding the output encoding though, atleast for http://api.sanskritworld.in/v0.0.1/jagAma/prakriya, which you claim is meant to be human readable - you should include the encoding=devanaagarii parameter. As it is, I find myself feeling the following:

  • I prefer to get the prakriya from the swagger interface, and not through some html/ js layer on top of it - so using this API directly is helful.
  • I don't feel like reading the "upadeSe'janunAsika it (1.3.2) -> gamx!", in this supposedly human readable output since it looks like gobbledygook to me.

Achieving this is quite simple - just use our indic_transliteration module and call sanscript. I can do it for you if you give me write permission here; and if dependencies are clear so that I can test it.

@drdhaval2785
Copy link
Owner Author

drdhaval2785 commented Dec 17, 2017

New APIs for version 0.0.2. See documentation at https://api.sanskritworld.in/.

Full data API - https://api.sanskritworld.in/v0.0.2/verbforms/slp1/jagAma?output_transliteration=devanagari (Recommended for UI development by @avinashvarna , as it has all possible info.)

prakriya API - https://api.sanskritworld.in/v0.0.2/verbforms/slp1/jagAma/prakriya?output_transliteration=devanagari

Rest two APIs would not be much of interest, as they are subset / modification of the earlier two.

https://api.sanskritworld.in/v0.0.2/verbforms/slp1/jagAma/{argument}?output_transliteration=devanagari
See documentation for argument details.
https://api.sanskritworld.in/v0.0.2/verbforms/slp1/jagAma/prakriya/machine?output_transliteration=devanagari - returns prakriya in lists.

@drdhaval2785
Copy link
Owner Author

@avinashvarna
Please adjust the UI.

You can tweak the output_transliteration parameter with other values and see if the data is returned in proper encoding or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants