Skip to main content

Endpoints

Detailed documentation for our API calls. Authentication is required for all calls. You can find your API key in your profile.

info

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

FieldTypeDescriptionDefault valueRequired
AuthorizationBearer TokenAuthentication token✔️
expandstringExpanded fields
fieldsstringFields returned by the request
hrefbooleanReturns the URL of an individual documentfalse
dateFormatstringFormats date and time fieldsphp:d.m.Y H:i:s
dateFieldsstringFormats 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

GET
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

GET
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

GET
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.

info
{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

info

Many records can have a field that stores a reference to another record. See reference-based field setting.

Headers

FieldTypeDescriptionDefault valueRequired
AuthorizationBearer TokenAuthentication token✔️
expandstringExpanded fields
fieldsstringFields returned by the request
hrefbooleanReturns the URL of an individual documentfalse
dateFormatstringFormats date and time fieldsphp:d.m.Y H:i:s
dateFieldsstringFormats only the specified fields
ignoreMissingReferenceboolean(true|false) Used with reference-based field settingfalse
ignoreDuplicateReferenceboolean(true|false) Used with reference-based field settingtrue
fillPlaceholdersbooleanWhen uploading .docx files, it automatically attempts to fill in the 'placeholder' fields.false
removeUnfiledPlaceholdersbooleanWhen 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

POST
https://{DOMAIN}/{CONTROLLER}/api/default/create

Description

The API call creates a new record and returns its data.


Update a record

POST
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

FieldTypeDescriptionDefault valueRequired
AuthorizationBearer TokenAuthentication token✔️
Example
{
"Authorization": "xfWuluzj..."
}

Delete a record

DELETE
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

FieldTypeDescriptionDefault valueRequired
AuthorizationBearer TokenAuthentication token✔️
Example
{
"Authorization": "xfWuluzj..."
}

Record info

OPTIONS
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.*",
...
}
}
info

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