Vocabulary dictionary

Kanji dictionary

Grammar dictionary

Sentence lookup

test
 

Forums - Interested in working with a renshuu API?

Top > renshuu.org > Developer corner

Page: 4 of 9



avatar
マイコー
Level: 283

1. I'll try to get those weird indexes out of config. Values:

unique-furigana - the reading cannot be perfectly matched to the kanji (like /きょう)

katakana- has katakana in it

common-hiragana - usually written without kanji

ent_primary - jmdict reference. this is the main kanji/hiragana pair for a set of related terms. Example: 作る (it is the primary form, although there are two alternates)

ent_single - jmdict reference. this entry does not have any alternate forms

'ateji','rK','io','ik','iK','oK','sk','sK' <-- all jmdict tags. See https://www.edrdg.org/jmdict/j...


2. issue is fixed.

3. The response codes should not be trusted yet. There is no way you can access other data, so don't worry about that. It's just that the codes haven't been implemented.

4. total_page fixed. Although...I guess I need to align the pg as well - it's currently counting from 0, whereas the total is counting from 1. Start pg from 1?

5. if requested page goes over, it now shows "pg" as the correct page (well, issue from #4 aside)

6. Sure, I can add alt-form ids (later)

7. It's attached to the hidden input with id="api_key" inside of the settings panel. Will consider moving it "outside" later on.

0
6 months ago
Report Content
avatar
ブルブルクン
Level: 688

2. I think you "fixed" 入賞 in the wrong direction. In the dictionary, now looks like it has 2 meanings instead of one. The api result looks unchanged to me.

4. I agree with starting from page 1 to make the numbers consistent.

7. Nice, thanks!

0
6 months ago
Report Content
avatar
マイコー
Level: 283

1. Fixed page numbers (starts on 1)

2. Also added ids to alternate forms.

3. I started working on an openapi json file, I guess I need a system that will output nice html from that for reference - I searched a bit, but didn't see anything that was a once-and-done (I don't think I'll be updating it so much that I need a complex system, just a onetime /json2html.sh input.json outputdir

kind of thing.

As to the schedules thing, I'll get the error codes up as soon as I can figure out what to add. This is a tricky one - so let's say they do a put/delete on the word , and the schedule/list part doesn't work. Should I return *nothing*, and an error code, or return the word object like I usually do, then an error field that explains what happened? If that was the case, would the http response code still be normal (200)?

0
6 months ago
Report Content
avatar
イクト
Level: 1088

3. I started working on an openapi json file, I guess I need a system that will output nice html from that for reference - I searched a bit, but didn't see anything that was a once-and-done (I don't think I'll be updating it so much that I need a complex system, just a onetime /json2html.sh input.json outputdir

kind of thing.

SwaggerUI is the most common tool to to this with I think. It's just some static html and js files. You just point your openapi.json to it, it generates everything on client side, so you only ever have to update the json file. No need to generate anything. https://swagger.io/tools/swagg... https://github.com/swagger-api...

0
6 months ago
Report Content
avatar
ブルブルクン
Level: 688

https://github.com/buruburukun/renshuu_helper updated to handle new page numbers and alternate forms! Please try it out!

As for return codes, I believe you can return 4xx and while also returning a response which could have the explanation of the error, but I could be wrong about that. As an aside, I thought it was a bit weird that the PUT/DELETE endpoints returned the word at all. It makes the endpoint feel like it's doing more than it should. I think your intent there is so the client can know the latest presence information?

And an additional bug report: searching for あちら with the api returns a strange definition 2 with a triple "&": "that (one) (something physically distant from both speaker and listener&&& or something not visible but known by both speaker and listener)"

0
6 months ago
Report Content
avatar
マイコー
Level: 283

As for return codes, I believe you can return 4xx and while also returning a response which could have the explanation of the error, but I could be wrong about that. As an aside, I thought it was a bit weird that the PUT/DELETE endpoints returned the word at all. It makes the endpoint feel like it's doing more than it should. I think your intent there is so the client can know the latest presence information?

And an additional bug report: searching for あちら with the api returns a strange definition 2 with a triple "&": "that (one) (something physically distant from both speaker and listener&&& or something not visible but known by both speaker and listener)"

Fixed the &&& issue.

Cleaned up put/delete results

Added 404 when list/schedule/term could not be found/verified (I hope!), 409 when everything found, but update could not been done (ex: removing term from list in which it is not present).

@イクト - I'll check out swagger.io, thanks! It looks quite promising.

0
6 months ago
Report Content
avatar
マイコー
Level: 283

So, I tried putting together the json for the openapi spec

https://new.renshuu.org/api.js...

And then put it in here: https://editor-next.swagger.io... (easy to do, no login required)

Not sure why, but you cannot load that url into swagger - you need to copy/paste the text. Also, something is wrong with the http bearer docs in the json, making it so swagger cannot do test calls.

That being said, please take a look and see what you think. If it looks good, I'll expand it out for the put/delete, as well as add the object definitions for the lists/schedules returned under presence.

0
6 months ago
Report Content
avatar
イクト
Level: 1088

So, I tried putting together the json for the openapi spec

https://new.renshuu.org/api.js...

Not sure why, but you cannot load that url into swagger - you need to copy/paste the text.

Your sever has to send cors headers in the reply, otherwise the browser will refuse to accept the response.
You have to send a "access-control-allow-origin: *" http header. (Or a list of domains that are allowed to accept the response if you dont want to put a * there)
Access-Control-Allow-Methods might be required too. https://developer.mozilla.org/... (I think it's some security feature)

For the api endpoints it would probably also be good to set the origin header to *.


Edit:

When I press the link to the api.json (without opening it in a new tab), the URL changes, I get the kao running animation, but nothing happens.

0
6 months ago
Report Content
avatar
マイコー
Level: 283

Yea - you have to access the api.json (I actually made an api.yaml that is a bit more accurate) outside of renshuu, as in, copy-paste the link.

It looks like the cors issue is only for the specific way that page is trying to access it. I made a free swagger.io acct, and that one runs just fine.

I'm not sure I want to run another web server just for this on my current nginx box, so I may spin up a mini server and throw both the endpoints and the docs on there.

So ignore the "try it out", and see if the rest of the docs there look decent.

0
6 months ago
Report Content
avatar
マイコー
Level: 283

May be broken in a few spots, but...too excited not to share:


https://api.renshuu.org/ <-- docs!!

https://api.renshuu.org/v1/ <-- new endpoint (noted in docs)

2
6 months ago
Report Content
avatar
イクト
Level: 1088

The cors stuff is relevant when JavaScript running on one domain tries to request stuff that is provided by a different one.


why would you need a second Webserver? I don't know about nginx but can't you serve the API from the normal server?

0
6 months ago
Report Content
avatar
マイコー
Level: 283

I like to keep things separate - the api is coming off of the same server, just proxied through api.renshuu.org which runs nodejs for the docs.

0
6 months ago
Report Content
avatar
イクト
Level: 1088

Tiny nitpick I just noticed when trying the swagger page. The api server seems to respond with

 content-type: text/html; charset=UTF-8 

instead of saying that the response is application/json.

0
6 months ago
Report Content
avatar
ブルブルクン
Level: 688

On the api server, Access-Control-Allow-Headers needs to include Authorization

0
6 months ago
Report Content
avatar
マイコー
Level: 283

both header issues fixed

/schedule fleshed out, should be data complete (updated on docs, too)

/kanji and /grammar are both live, in docs too.

Will probably get /sentence done tomorrow!


0
6 months ago
Report Content
avatar
マイコー
Level: 283

/reibun/search?value=こと added

/reibun/search/{word_id} also added

0
6 months ago
Report Content
avatar
マイコー
Level: 283

Is there some kind of standard for reporting api remaining limits? a few fields attached to every call (you've used xx today. You have yy remaining).

0
6 months ago
Report Content
avatar
イクト
Level: 1088

It seems there was a draft to make this a standard via http headers, but it looks like it didn't become an official standard. https://www.ietf.org/archive/i...

0
6 months ago
Report Content
avatar
マイコー
Level: 283

/profile is UP, and on the docs page.

Please let me know what else you'd like to see added. This will be self-lookup only, so pretty much the sky's the limit.

1
6 months ago
Report Content
avatar
ライフェン
Level: 351

/profile is UP, and on the docs page.

Please let me know what else you'd like to see added. This will be self-lookup only, so pretty much the sky's the limit.


Community/my lists if endpoints are not yet created.

And with ^ ability to manipulate lists (add/remove content in the list)

Can't find this in docs, so assume it is not ready.

0
6 months ago
Report Content
Getting the posts


Page: 4 of 9



Top > renshuu.org > Developer corner


Loading the list
Lv.

Sorry, there was an error on renshuu! If it's OK, please describe what you were doing. This will help us fix the issue.

Characters to show:





Use your mouse or finger to write characters in the box.
■ Katakana ■ Hiragana