Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:manualy:api [2022/12/16 16:07] – created michalkren | en:manualy:api [2022/12/29 19:11] (current) – [API] michalkren | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== API ====== | ====== API ====== | ||
- | It is possible to access selected | + | Selected |
- | ===== Getting | + | ===== Getting |
- Log in to the CNC web portal. | - Log in to the CNC web portal. | ||
Line 17: | Line 17: | ||
A session cookie will be returned that should be used in every other request. It may be useful to save the session cookie and use it repeatedly within the next few hours. | A session cookie will be returned that should be used in every other request. It may be useful to save the session cookie and use it repeatedly within the next few hours. | ||
- | Every application has an API tailored to its needs. API use manuals: | + | <WRAP tip important 60%> |
+ | Individual | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | </ | ||
- | ===== Usage examples ===== | + | The APIs can be queried at the following URLs: |
+ | * KonText: '' | ||
+ | * Treq: '' | ||
- | ==== curl ==== | + | <WRAP round important 60%> |
+ | Every application also imposes its own **limits**. After exceeding them, there is a risk of blocking access to the API. | ||
+ | * **KonText**: | ||
+ | * **Treq**: max. 30 requests per minute and max. 5000 requests per day | ||
+ | </ | ||
- | Querying | + | ===== Usage examples ===== |
+ | |||
+ | ==== 1) curl and Treq API ==== | ||
<code bash> | <code bash> | ||
Line 36: | Line 46: | ||
</ | </ | ||
- | ==== Python | + | ==== 2) Python |
- | + | ||
- | Querying KonText | + | |
<code python> | <code python> | ||
Line 95: | Line 103: | ||
" | " | ||
} | } | ||
- | r = s.post(' | + | r = s.post(' |
response_json = r.json() | response_json = r.json() | ||
print(response_json) | print(response_json) | ||
Line 101: | Line 109: | ||
# Displaying a concordance | # Displaying a concordance | ||
conc_persistence_op_id = response_json[' | conc_persistence_op_id = response_json[' | ||
- | r = s.get(' | + | r = s.get(' |
print(r.json()) | print(r.json()) | ||