Api Call Examples

This page describes the REST API endpoints for the clients of the Brewer's Yeast domain to interact with the Oculyze platform, located at https://srv.oculyze.de/services/handler/

  • REST ENDPOINT

  • HTTP METHOD

  • REQUEST ARGUMENT

  • https://srv.oculyze.de/services/handler/v1/batches
  • OPTIONS,HEAD
  • https://srv.oculyze.de/services/handler/v1/batches
  • GET
  • user_id, group, method, page (in args), page_size (in args) , count (in args), state, states ( mutually exclusive with param:state) , method, min_viability, max_viability, st_date_creation, end_date_creation, min_concentration, max_concentration, oculyze_app_id, tags, tag_search_key, name, desc
  • https://srv.oculyze.de/services/handler/v1/batches
  • POST
  • name, desc, app_version, created_locally_at, fermented_at, method, method_attributes, oculyze_app_id, tags
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>
  • OPTIONS,HEAD
  • Request argument
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>
  • PUT
  • name, dilution_stain, dilution_stain_1, dilution_stain_2, dilution_sample, dilution_sample_1, dilution_sample_2, desc, state, method, result_stat,image_volume, app_version, created_locally_at, density,scale_type,fermented_at,oculyze_app_id
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>
  • GET
  • name, dilution_stain, dilution_stain_1, dilution_stain_2, dilution_sample, dilution_sample_1, dilution_sample_2, desc, state, method, result_stat,image_volume, app_version, created_locally_at, density,scale_type,fermented_at,oculyze_app_id
  • https://srv.oculyze.de/services/handler//batches/<batch_id>/tasks/
  • HEAD, PUT, GET, OPTIONS
  • PUT: image
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>/tasks/<task_id>/<field>
  • HEAD, GET, OPTIONS
  • field: id, result_stat, state
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>/tasks/<task_id>/input_image
  • HEAD, GET, OPTIONS
  • size
  • https://srv.oculyze.de/services/handler/v1/batches/<batch_id>/tasks/<task_id>/result_image
  • HEAD, GET, OPTIONS
  • size
  • https://srv.oculyze.de/services/handler/v1/aggregation
  • HEAD, PUT
  • PUT optional params: aggr_user_id, reset

Api Call Examples

This page describes the REST API endpoints for the clients of the Brewer's Yeast domain to interact with the Oculyze platform, located at https://srv.oculyze.de/services/handler/

Request Parameters

field_name
objectid
example
user_idobjectiduser_id=566821242313886deea14299user objectid
batch_idobjectidbatch_id=566821242313886deea14299batch objectid
groupstringgroup=oculyzegroup name
methodmethod idmethod=12=concentration, 1=concentration and viability
pageunsigned integer greater 0page=1the page number
page_sizeunsigned integer greater 0page_size=10number of records per page, Default 25
countboolcount=Truebool indicator to get the count of the query result. Default: False
namestringname=Yeast123analyses name
descstringdesc=“My first analyses”
statestate idstate=0ERROR=-1,IN_PROGRESS=0, UPLOAD_COMPLETE=1, RESULT_READY=2,ABORTED_BY_USER=254, ABORTED_BY_SYSTEM=255, USER_FERMENTATION_START=3, FERMENTATION_ONGOING = 4 , USER_FERMENTATION_COMPLETED = 5, FERMENTATION_COMPLETE = 6, WINE_UPLOAD_COMPLETED = 7, WINE_RESULT_READY = 8
sizethumbnailsize=thumbnailto get a thumbnail of the image
min_viabilityfloatmin_viability=30.5to obtain those batches whose viability scores are greater than or equal to the given value
max_viabilityfloatmax_viability=55.2to obtain those batches whose viability scores are less than or equal to the given value
st_date_creationdate (in ISO8601 format)st_date_creation=2017-04-24T12:11:24to obtain those batches that were created on or later than the given date
end_date_creationdate (in ISO8601 format)end_date_creation=2017-05-01T12:11:24to obtain those batches that were created on or earlier than the given date
min_concentrationfloatmin_concentration=10.5to obtain those batches whose concentration scores are greater than or equal to the given value
max_concentrationfloatmax_concentration=99.5to obtain those batches whose concentration scores are less than or equal to the given value
image_volumefloatimage_volume=0.000028to specify the volume of the chamber used for sample
dilution_stainfloatdilution_stain=0.5to specify the ratio of stain used to dilute the sample (legacy)
dilution_stain_1floatdilution_stain_1=0.5to specify the numerator to calculate the above ratio
dilution_stain_2floatdilution_stain_2=0.5to use as part of the denumerator to calculate the above ratio
dilution_samplefloatdilution_sample=1.0to specify the ratio of the sample (legacy)
dilution_sample_1unsigned integer greater 0dilution_sample_1=1.0to specify the numerator to calculate the above ratio
dilution_sample_2floatdilution_sample_2=1.0to use as part of the denumerator to calculate the above ratio
app_versionstringapp_version='0.10.2'version of the android app accessing the API
aggr_user_idobjectidaggr_user_id=566821242313886deea14299objectid of the user the bulk aggregation will work on
resetboolreset=Truebool indicator to reset _aggregated_at fields of batches to UNIX_EPOCH, when used with aggregation/ endpoint. Default: False
tagsstringtag='{“tag”: { “yeast”:[“Belgian-Mix-10”],“beer” : [“ale”], “tank” : [“12”]}}'a tag in valid JSON
tag_search_keystring“Belgian-Mix-10”free style text string
created_locally_atdate (in ISO8601 format)created_locally_at=2018-01-11T12:11:24the date this batch has been created by client - will be usefull in case no internet connection was available at creation time
densityfloatdensity=120.34sugar density as measured by the brewer in the field
scale_typeintscale_type=1OECHSLE(0), BRIX(1), KMW(2), BAUME(3)
oculyze_app_idintoculyze_app_id=4id of the app according to the doamin
fermented_atdate (in ISO8601 format)fermented_at=2019-05-15T12:11:24the date this batch has been put to fermentation - will be used in calculating the expected yeast/sugar densities later

Examples of use

The `http` command line tool that is used to execute the following sample calls is downloadable at: https://httpie.org/

Due to historical reasons, the measurements have been technically referrred to as 'Batches' in the actual Oculyze Platform API .

The Bearer token that must accompany the calls to the API must be obtained through a authentication endpoint. Please get in touch with our Engineering Team regarding a valid access credential.

Calls for Creating and Modifying a Batches (Measurements) ;

Create a Batch

http -f --auth Bearer:r5o7RIcqDwAhkZBHDcKpHR7gSbx1cv POST https://srv.oculyze.de/services/handler/v1/batches method=2 name='wort'  desc=test app_version=13.0.2 method_attributes='{"stain": 1, "analysis_level": 2}'
Add Task with image

http -v -f --auth Bearer:r5o7RIcqDwAhkZBHDcKpHR7gSbx1cv PUT https://srv.oculyze.de/services/handler/v1/batches/5b3f8f68477b490017efbb45/tasks image@/path/to/image.jpg
Update batch values and state to trigger aggregation on backend

http -f --auth Bearer:r5o7RIcqDwAhkZBHDcKpHR7gSbx1cv PUT https://srv.oculyze.de/services/handler/v1/batches/5b3f8f68477b490017efbb45 state=1 dilution_sample=1 dilution_sample_1=1 dilution_sample_2=1 dilution_stain=1 dilution_stain_1=1 dilution_stain_2=1 image_volume=5.600000000000001e-06
Querying Batches

To get a page of existing batches, with results;
~ ❯❯❯ http --auth Bearer:9uTl8EVWJ1UVNqeyTh7HuuFGsAigMz GET https://srv.oculyze.de/services/handler/v1/batches\?page_size\=1
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 1681
Content-Type: application/json
Date: Fri, 24 Aug 2020 10:11:51 GMT
Server: nginx

[
{
"created_at": "Sun, 12 Aug 2020 17:37:50 GMT",
"desc": "",
"dilution_sample": 1.0,
"dilution_stain": 0.8,
"id": "58a09d6eacf4fd001c85655a",
"method": 2,
"modified_at": "Sun, 12 Aug 2020 17:38:24 GMT",
"name": "",
"result_stat": {
"area": {
"hist": [
[
1,
3,
2,
0,
1,
2,
0,
2,
1,
3
],
[
1796.0,
2566.8,
3337.6,
4108.4,
4879.2,
5650.0,
6420.799999999999,
7191.599999999999,
7962.4,
8733.2,
9504.0
]
],
"mean": 5754.8,
"std": 2663.0071272904997
},
"conz": 1.0714285714285714,
"countTotal": {
"hist": [
[
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
],
[
14.5,
14.6,
14.7,
14.8,
14.9,
15.0,
15.1,
15.2,
15.3,
15.4,
15.5
]
],
"mean": 15.0,
"std": 0.0
},
"meanDia": {
"hist": [
[
1,
2,
1,
2,
0,
1,
2,
1,
0,
5
],
[
48.0,
54.6,
61.2,
67.8,
74.4,
81.0,
87.6,
94.19999999999999,
100.8,
107.4,
114.0
]
],
"mean": 85.66666666666667,
"std": 21.89266746855871
}
},
"state": 2,
"tasks": [
{
"id": "58a09d7facf4fd001b62c288",
"result_stat": {
"area": [
7583,
9504,
8617
],
"circPct": [
59,
86,
76
],
"countTotal": 3,
"meanDia": [
111,
110,
108
]
},
"state": 2
},
{
"id": "58a09d83acf4fd001c85655c",
"result_stat": {
"area": [],
"circPct": [],
"countTotal": 0,
"meanDia": []
},
"state": 2
},
{
"id": "58a09d88acf4fd001b62c291",
"result_stat": {
"area": [
2692,
3039,
3340,
6253
],
"circPct": [
71,
76,
65,
87
],
"countTotal": 4,
"meanDia": [
61,
64,
70,
89
]
},
"state": 2
},
{
"id": "58a09d8eacf4fd001c85656a",
"result_stat": {
"area": [
1796,
6141,
3415,
5358,
8811,
2621
],
"circPct": [
84,
82,
66,
84,
62,
88
],
"countTotal": 6,
"meanDia": [
48,
89,
70,
84,
114,
57
]
},
"state": 2
},
{
"id": "58a09d92acf4fd001aa0409c",
"result_stat": {
"area": [
9417,
7735
],
"circPct": [
83,
89
],
"countTotal": 2,
"meanDia": [
111,
99
]
},
"state": 2
}
],
"user": "56bdbe17231388031fc1e382"
}
]

To get an already existing batch by the BatchID

http --auth Bearer:9uTl8EVWJ1UVNqeyTh7HuuFGsAigMz GET https://srv.oculyze.de/services/handler/v1/batches/58a09d6eacf4fd001c85655a
Filtering Results

to filter batches based on batch creation dates
~ ❯❯❯ curl -u Bearer:<access_token> https://srv.oculyze.de/services/handler/v1/batches\?st_date_creation=20170301\&amp;end_date_creation=20170331 | jq '.[] | {id: .id, created_at: .created_at}'
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  4524  100  4524    0     0  29821      0 --:--:-- --:--:-- --:--:-- 29960
{
"id": "58d905a2acf4fd001a1bc02e",
"created_at": "Mon, 27 Mar 2017 12:29:22 GMT"
}
{
"id": "58cfc7f2191926006f22dbd0",
"created_at": "Mon, 20 Mar 2017 12:15:46 GMT"
}

to obtain the count only (for the previous query)

~ ❯❯❯ curl -u Bearer:<access_token> https://srv.oculyze.de/services/handler/v1/batches\?st_date_creation=20170301\&amp;end_date_creation=20170331\&amp;count=True
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  13  100  13    0     0  29821      0 --:--:-- --:--:-- --:--:-- 29960</access_token></access_token>

{ 'count': 2}
 

Get in touch for full documentation


Your Name (required)

Your Email (required)

Subject

Your Message

 Subscribe me to your mailing list

Protected by reCAPTCHA.
Privacy & Terms