Skip to content

Commit

Permalink
docs(api texts): status codes of get_texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
YishaiGlasner committed Jun 21, 2023
1 parent 3268846 commit a40741f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@


def get_texts(request, tref):
"""
handle text request based on ref and query params
status codes:
400 - for invalid ref or empty ref (i.e. has no text in any language)
405 - unsuppored method
200 - any other case. when requested version doesn't exist the returned object will include the message
"""
try:
oref = Ref.instantiate_ref_with_legacy_parse_fallback(tref)
except Exception as e:
Expand All @@ -20,4 +27,4 @@ def get_texts(request, tref):
handler = APITextsHandler(oref, versions_params)
data = handler.get_versions_for_query()
return jsonResponse(data, cb)
return jsonResponse({"error": "Unsupported HTTP method."}, cb)
return jsonResponse({"error": "Unsupported HTTP method."}, cbdocs)

0 comments on commit a40741f

Please sign in to comment.