Getting Started
Overview
Calls for MQ Online API v1 are relative to the URL https://online.mqzh.ch/api/v1
For testing purposes use this endpoint: https://mqonline.alexander-feil.dev/api/v1
Authentication
All API calls must be authenticated with a token in the authorization header. You can generate an API Token within your user account under the settings tab.
Authorization: Bearer <api-token>
Make sure to replace
<api-token>with your personal API Token.
MQ online expects for the API Token to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer <api-token>
User
Get the current user
curl "https://mqonline.alexander-feil.dev/api/v1/user" \
-H "Authorization: <api-token>"
The above command returns JSON structured like this:
{
"id": 1030,
"name": "MQ Verein für med. Qualitätskontrolle",
"email": "notice@llm.ch",
"participants": [
{
"identifier": "2000",
"name": "MQ Verein für medizinsiche Qualitätskontrolle"
},
{
"identifier": "4337",
"name": "Med. Mikrobiologie"
}
],
"created_at": "2016-04-01 19:15:17",
"updated_at": "2022-12-07 11:12:40"
}
This endpoint retrieves the current user. It also lists all participants the user has access permissions.
Endpoint
GET /user
Records
Get records
Example request (multiple records)
curl --request GET \
--url https://mqonline.alexander-feil.dev/api/v1/records/2000 \
--header 'Accept: application/json' \
--header 'Authorization: <api-token>'
Example response (multiple records)
[
{
"id": 4066129,
"methodIndex": 2475,
"deviceId": "",
"possibleValues": [
"négatif",
"positif"
],
"deviceDescription": "ImmunoCAP rapid",
"methodDescription": "m6 Moisissure",
"unit": null,
"value": "négatif",
"status": "1",
"updated_at": "2022-12-07 17:57:06"
},
{
"id": 4048643,
"methodIndex": 1188,
"deviceId": "",
"possibleValues": null,
"deviceDescription": "Afinion",
"methodDescription": "Creatinin Urin",
"unit": "mmol\/l",
"value": null,
"status": "1",
"updated_at": "2022-12-07 11:11:16"
},
{
"id": 4048641,
"methodIndex": 754,
"deviceId": "",
"possibleValues": null,
"deviceDescription": "Bild 5",
"methodDescription": "Urinsediment",
"unit": "Code",
"value": null,
"status": "1",
"updated_at": "2022-12-07 11:11:16"
}
]
Example request (single record)
curl --request GET \
--url 'https://mqonline.alexander-feil.dev/api/v1/records/2000?methodIndex=1117&deviceId=&=' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <api-token>'
Example response (single record)
[
{
"id": 4066128,
"methodIndex": 1124,
"deviceId": "",
"possibleValues": [
"négatif",
"positif"
],
"deviceDescription": "ImmunoCAP rapid",
"methodDescription": "D1 Derm. pteronyssin.",
"unit": null,
"value": "positif",
"status": "1",
"updated_at": "2022-12-08 09:48:56"
}
]
Returns results of a running survey. With the optional parameter you can filter for specific results.
Endpoint
GET /records/:identifier
:identifier is the participants identifier
Optional parameters
A unique identifier is the combination of methodIndex and deviceId. If you specify only one parameter, you get a
list of results.
methodIndexdeviceId
Update a record
Example request
curl --request PUT \
--url 'https://mqonline.alexander-feil.dev/api/v1/records/2000?methodIndex=1116&deviceId=&value=n%C3%A9gatif&status=ok' \
--header 'Accept: application/json' \
--header 'Authorization: <api-token>'
Example Response
{
"id": 4066128,
"methodIndex": 1124,
"deviceId": "",
"possibleValues": [
"négatif",
"positif"
],
"deviceDescription": "ImmunoCAP rapid",
"methodDescription": "D1 Derm. pteronyssin.",
"unit": null,
"value": "positif",
"status": 1,
"updated_at": "2022-12-08 09:48:56"
}
Updates a result with given data.
Endpoint
PUT /records/:identifier
Required parameter
methodIndexdeviceIdvalue- must be the value or an item ifpossible_valueswithin the record
Optional parameter
statusTest status. The following values are possible:ok- everything is fineerror- the device returns an errorsuspended- the test is temporarily suspendedobsolete- the test is obsolete
Files
Get files index
Example request
curl --request GET \
--url 'https://mqonline.alexander-feil.dev/api/v1/files/2000' \
--header 'Accept: application/json' \
--header 'Authorization: <api-token>'
Example Response
{
"reports": [
{
"id": 251157,
"type": "reports",
"filename": "mq_20231_02000",
"extension": "pdf",
"period": "2023-01",
"url": "http://mqonline.test/api/v1/files/2000/251157"
},
{
"id": 237321,
"type": "reports",
"filename": "mq_20224_02000",
"extension": "pdf",
"period": "2022-04",
"url": "http://mqonline.test/api/v1/files/2000/237321"
},
{
"id": 227540,
"type": "certificate-results",
"filename": "mq_zert_2022_04760_1",
"extension": "pdf",
"period": "2022",
"url": "http://mqonline.test/api/v1/files/2000/227540"
},
]
}
Returns an index of report and certificate files, available for a specific participant.
Endpoint
GET /files/:identifier
:identifier is the participants identifier
Download a file
Example request
curl --request GET \
--url 'https://mqonline.alexander-feil.dev/api/v1/files/2000/251157' \
--header 'Accept: application/json' \
--header 'Authorization: <api-token>'
Example Response
{}
Return the requested PDF file.
Endpoint
GET /files/:identifier/:id
:identifieris the participants identifier:idis the id of the requested file