Endpoints
Detailed documentation for our API calls. Authentication is required for all calls. You can find your API key in your profile.
The URLs on this page contain variable parts that must be replaced with actual values for your case, for example:
https://test.mdocs-plus.si/document/api/default/view?id=2
GET calls
Headers
| Field | Type | Description | Default value | Required |
|---|---|---|---|---|
| Authorization | Bearer Token | Authentication token | ✔️ | |
| expand | string | Expanded fields | ||
| fields | string | Fields returned by the request | ||
| href | boolean | Returns the URL of an individual document | false | |
| dateFormat | string | Formats date and time fields | php:d.m.Y H:i:s | |
| dateFields | string | Formats only the specified fields |
Example
{
"Authorization": "xfWuluzj...",
"expand": "documentType.*,createdBy.name",
"fields": "id,subject",
"href": "true",
"dateFormat": "php:d/m/Y",
"dateFields": "created_at,updated_at"
}
Get records
https://{DOMAIN}/{CONTROLLER}/api/default
Description
The API call returns all results the user has access to.
// GET https://{DOMAIN}/document/api/default
{
{
"id": 1,
"description": "xyz",
},
{
"id": 2,
"description": "123",
},
...
}
View a record
https://{DOMAIN}/{CONTROLLER}/api/default/view?id={ID}
Description
The API call returns the data of the record with the given ID, if the user has access to it.
// GET https://{DOMAIN}/document/api/default/view?id=1
{
"id": 1,
"description": "xyz",
...
}
list-objects
https://{DOMAIN}/{CONTROLLER}/api/default/list-objects?id={ID}&attribute={ATTR}
Description
list-objects provides direct access to the record stored in a chosen reference field of the selected record.
{ID} represents the ID of the record whose reference field data we want to retrieve
{ATTR} represents the name of the reference field whose associated record we want to retrieve
You can find the names of reference fields using the info call, under the expandable key.
// GET /document skupaj z expand.createdBy zaglavjem
// pridobimo zapis Document z id=2
{
"id": 2,
"created_by": 12,
"createdBy": {
// podatki povezanega zapisa User
"id": 12,
"first_name": "Janez",
"last_name": "Novak"
}
}
The list-objects call, on the other hand, returns the record stored in the reference field directly — in this case the record of the User model stored in the reference field created_by.
Using list-objects gets us the same data as calling /get for the model of the reference field, e.g. api/user/view?id=12.
Because we retrieve the referenced record directly, we can also call the expand header on it.
// GET /list-objects?id=2&attribute=createdBy
// pridobimo zapis User z id=12
{
"id": 12,
"first_name": "Janez",
"last_name": "Novak"
}
POST calls
Many records can have a field that stores a reference to another record. See reference-based field setting.
Headers
| Field | Type | Description | Default value | Required |
|---|---|---|---|---|
| Authorization | Bearer Token | Authentication token | ✔️ | |
| expand | string | Expanded fields | ||
| fields | string | Fields returned by the request | ||
| href | boolean | Returns the URL of an individual document | false | |
| dateFormat | string | Formats date and time fields | php:d.m.Y H:i:s | |
| dateFields | string | Formats only the specified fields | ||
| ignoreMissingReference | boolean | (true|false) Used with reference-based field setting | false | |
| ignoreDuplicateReference | boolean | (true|false) Used with reference-based field setting | true | |
| fillPlaceholders | boolean | When uploading .docx files, it automatically attempts to fill in the 'placeholder' fields. | false | |
| removeUnfiledPlaceholders | boolean | When uploading .docx files, it hides all 'placeholder' fields that were not filled in automatically. | false |
Example
{
"Authorization": "xfWuluzj...",
"expand": "documentType.*,createdBy.name",
"fields": "id,subject",
"href": "true",
"dateFormat": "php:d/m/Y",
"dateFields": "created_at,updated_at",
"ignoreMissingReference": "true",
"ignoreDuplicateReference": "false",
"fillPlaceholders": "false",
"removeUnfiledPlaceholders": "false"
}
Create a record
https://{DOMAIN}/{CONTROLLER}/api/default/create
Description
The API call creates a new record and returns its data.
Update a record
https://{DOMAIN}/{CONTROLLER}/api/default/update?id={ID}
Description
The API call updates a record, if the user has access to it. The updated record is returned as the response.
DELETE calls
Headers
| Field | Type | Description | Default value | Required |
|---|---|---|---|---|
| Authorization | Bearer Token | Authentication token | ✔️ |
Example
{
"Authorization": "xfWuluzj..."
}
Delete a record
https://{DOMAIN}/{CONTROLLER}/api/default/delete?id={ID}
Description
The API call deletes the given record, if the user has access to it.
OPTIONS calls
Headers
| Field | Type | Description | Default value | Required |
|---|---|---|---|---|
| Authorization | Bearer Token | Authentication token | ✔️ |
Example
{
"Authorization": "xfWuluzj..."
}
Record info
https://{DOMAIN}/{CONTROLLER}/api/default/info
Description
The API call returns details about the record.
// GET https://{DOMAIN}/document/api/default/info
{
"modelClass": "mikrografija.mdocs.document.models.api.Document",
"searchClass": "mikrografija.mdocs.document.models.search.DocumentSearch",
"attributes": {
"id": "ID",
"principal_id": "Principal ID",
"uuid": "UUID",
"company_id": "Subjekt",
"classification_code_id": "Klasifikacijski znak",
"created_by": "Ustvaril",
"updated_by": "Posodobil",
...
},
"expandable": {
"principal": "principal.*",
"company": "company.*",
"classificationCode": "classificationCode.*",
...
}
}
modelClass: the full name of the record's model
searchClass: the full name of the record's search model
attributes: the technical and display names of the fields
expandable: the reference fields