API

Common Information

The aB-Agenta API enables third-party programs to access aB-Agenta data. To enable the API, you have to install the aB-Agenta webservice and configure the API options.How to do this and the meaning of the options you can see here.


The API offers these functions:

The OpenAPI specifications can be found here: https://demoserver.artbase-software.de/api2_1/swaggerui

We recommend to use it on your own service with your own data and credentials to run tests that better suit your environment. (http(s)://your-server:port/api2_1/swaggerui)

Please keep in mind that aB-Agenta is not a cloud solution, but an offline application. The actual base url of your productive API is individual. There is no global API server. The url above is intended for testing purposes only.

aB-Agenta API Inbetriebnahme

Öffnen Sie aB-Agenta auf dem Rechner, auf dem aB-Agenta installiert ist und die "aB-Agenta Daten" liegen.

Wechseln Sie in das Applikationsmenü und klicken links auf den Eintrag "System-Verwaltung". Rechts im Abschnitt System-Module klicken Sie auf aBServer-Dienst Konfiguration.
Es öffnet sich das Konfigurationsfenster unseres Dienstes, der für die Bereitstellung Ihrer Daten über die aB-Agenta API zuständig ist.
FJ4FZUvDizY59CAX-konfiguration-dienst-2.PNG
Je nach Status und Einrichtung des Dienstes sind die Knöpfe hier unterschiedlich benannt und aktiviert. In unserem Beispiel ist der Dienst bereits konfiguriert und aktiv.
Klicken Sie nun auf Einstellungen. Es öffnet sich der folgende Dialog.
v3woRapN9y2jfkhX-5f4751a1-2819-4a9e-a9e8-a8f2767a6649.pngIm Abschnitt API können Sie die Einstellungen vornehmen, damit der Zugriff von InsurMagic auf Ihre aB-Agenta Daten funktioniert.
Zuerst wählen Sie einen lokalen Port. Auf diesem Port horcht die API auf Anfragen von außerhalb. Außerdem müssen Sie den Haken bei CORS setzen, damit Anfragen von anderen Seiten, wie z.B. InsurMagic, vom Dienst erlaubt werden.
Drücken Sie nun noch auf den Knopf Ports in der Windows-Firewall freigeben, sofern Sie die Windows-Firewall nutzen und diese eingeschaltet ist. Nutzen Sie eine andere Software-Firewall auf diesem Rechner, so müssen Sie dort den zugriff auf den oben eingestellten Port für TCP-Verbindungen erlauben.
Sollten Sie WhatsApp-Web und InsurMagic nur intern im Büro-Netzwerk nutzen, ist die Einrichtung nun schon abgeschlossen.
Sollte ein Zugriff von außerhalb, beispielsweise einem Remote-Arbeitsplatz, notwendig sein, so müssen Sie die Verbindung TSL/SSL-verschlüsseln, damit die Daten nicht im Klartext über das Internet übertragen werden.
Dazu setzen Sie den Haken bei TLS/SSL. Damit der verschlüsselte Zugriff auf die API funktioniert, wird zusätzlich eine Domain und ein Zertifikat für diese Domain benötigt. Tragen Sie also die Domain im dafür vorgesehenen Feld ein. Diese Domain muss so eingestellt sein, dass eine Anfrage über einen Webbrowser zu Ihrem Internet-Anschluss geroutet wird. Sprechen Sie Ihren EDV-Betreuer darauf an, damit er Ihnen dieses Routing einstellt.
Wenn diese Voraussetzungen erfüllt sind, können Sie ein Zertifikat nutzen. Klicken Sie für die Einstellungen auf Zertifikatseinstellungen. Was Sie dort einstellen müssen, können Sie unter Zertifikatseinstellungen nachlesen.
Nachdem alle Einstellungen getroffen wurden, klicken Sie auf Ok, damit diese übernommen werden. Der Dienst wird nun mit den neuen Einstellungen neu gestartet, so dass diese gültig werden.

API Troubleshooting

Grundregel

Logdatei prüfen

Service startet nicht

Service via localhost nicht erreichbar

Service im LAN nicht erreichbar

Service im WAN nicht erreichbar

Let’s Encrypt Zertifikat kann nicht ausgestellt werden

Anmeldung scheitert trotz korrekten Anmeldedaten

Kein Zugriff auf Dokumente

Object types, Properties and Selection lists

In aB-Agenta, data is available in a specific structure. It consists of records, each of which belongs to a specific object type and has multiple properties and values. 
Some object types inherit from others, resulting in a tree-like hierarchy in which each object type inherits the properties of its parent.
Keep in mind that there may be user-defined properties and object types.
The API has operations for retrieving object types and their properties. This allows you to determine their IDs and names.
Another way of looking up object types and properties is the Masken-Designer, a module of aB-Agenta.

Object types

Every record has a specific object type. A record is uniquely identifiable by its ID AND its object type.
Object types are entities (like customers, contracts etc.) and have properties. 
An object type may belong to an inheritance hierarchy, where it inherits the properties of its parent object type. The parent object type is referenced in the field "basicidobject".
An object type that has children is a "group". If you use a group while loading records you can retrieve records of different object types at once.
If you load records by a group you can only load properties that belong to that group.
The object type of a record can never be a group, it must be an end node that has no children.
If you try to save a record with a group as object type the operation will fail.
You can change a record's object type only if it inherits from one of the following groups:

Properties

Properties belong to specific object types and define the fields a record may have.
A property has a name and an internal name ("bound_on"). The name can be user-defined in aB-Agenta so whenever you reference a property (e.g. accessing fields of a record or setting up a query-filter) you must use the internal name.
A property has a data type ("datatype_user"):
A property has a property type ("type") (don't mistake with data type):
A property can have a selection list ("idlist") that contains the valid values that a record can have for that property.

Selection lists

A selection list is referenced by one or more properties and contains values that a record can have for those properties.
A selection list also has a data type ("datatype") that matches the ones of its properties.
There are two types of selection list: Encoded and Non-Encoded lists ("encoded")
  • encoded
    : records MUST store a value of one of the list entries (field "value" in list-entries)
  • non-encoded
    : records may save any value. The list entries are merely suggestions. (field "name" in list-entries)

Filter

The filter parameter in the
loadrecords
and
loadobjecttypes
functions is a complex JSON object representing the query criteria.
If the filter is omitted, no filter is applied.
A filter object can have different characteristics and also contain other filter objects. Multiple nested filters can therefore be defined.

Filter classes

Comparer

This filter performs one or more comparison operations on a field.
The properties of this filter have the name of a field and as value another object that describes the comparison operation and the comparison values:
{field name: {operator: value}}
Some comparison operations expect 2 or more comparison values. These are put into an array:
{field name: {operator: [value1, value2, ...]}}
Multiple comparison operations can also be specified for a single field by placing them in an array: (The comparison operations are ANDed, so they must all apply)
{field name: [{operator1: value1},{operator2: value2},...]}
Example:
{$system_id: {$equals, "123456"}}  ≙ select * from tab where system_id='123456'

comparison operations

OperatorValue (data type)DescriptionExamplecorresponds to this SQL query
$isEmptybooltrue only; field has empty value; identical to $isNull{system_id: {$isEmpty: true}}system_id IS NULL
$notEmptybooltrue only; field has no empty value{system_id: {$notEmpty: true}}system_id<>''
$isNullbooltrue only; field value is NULL{system_id: {$isNull: true}}system_id IS NULL
$notNullbooltrue only; field value is not NULL{system_id: {$notNull: true}}system_id IS NOT NULL
$equalsanyfield value equals comparison value{system_id: {$equals: "7"}}
shorthand: {system_id: "7"}
system_id='7'
$notEqualsanyfield value not equal to comparison value{system_id: {$notEquals: "7"}}system_id<>'7'
$endswithstringfield value ends with comparison value{system_id: {$endswith: "7"}}system_id LIKE '%7'
$startswithstringfield value starts with comparison value{system_id: {$startswith: "7"}}system_id LIKE '7%'
$containsstringfiel value contains comparison value{system_id: {$contains: "7"}}system_id LIKE '%7%'
$likestringfield value matches the pattern{system_id: {$like: "%7_7%"}}system_id LIKE '%7_7%'
$inany[]field value equals one of the comparison values{system_id: {$in: ["7","8","9"]}}system_id IN ('7','8','9')
$notInany[]field value not equal to any of the comparison values{system_id: {$notIn: ["7","8","9"]}}system_id NOT IN ('7','8','9')
$betweenany[2]field value lies between the two comparison values{system_id: {$between: ["7","9"]}}system_id BETWEEN '7' AND '9'
$notBetweenany[2]field value not lies between the two comparison values{system_id: {$notBetween: ["7","9"]}}system_id NOT BETWEEN '7' AND '9'
$gtanyfield value is greater than comparison value{system_id: {$gt: "7"}}system_id > '7'
$gteanyfield value is greater than or equal to comparison value{system_id: {$gte: "7"}}system_id >= '7'
$ltanyfield value is less than comparison value{system_id: {$lt: "7"}}system_id < '7'
$lteanyfield value is less than or equal to comparison value{system_id: {$lte: "7"}}system_id <= '7'
$equals_fieldstringfield value is equal to specified other field{system_last_change_at: {$equals_field: "system_created_at"}}system_last_change_at = system_created_at
$notEquals_fieldstringfield value not equal to specified other field{system_last_change_at: {$notEquals_field: "system_created_at"}}system_last_change_at <> system_created_at
$gt_fieldstringfield value is greater than specified other field{system_last_change_at: {$gt_field: "system_created_at"}}system_last_change_at > system_created_at
$gte_fieldstringfield value is greater than or equal to specified other field{system_last_change_at: {$gte_field: "system_created_at"}}system_last_change_at >= system_created_at
$lt_fieldstringfield value is less than specified other field{system_last_change_at: {$lt_field: "system_created_at"}}system_last_change_at < system_created_at
$lte_fieldstringfield value is less than or equal to specified other field{system_last_change_at: {$lte_field: "system_created_at"}}system_last_change_at <= system_created_at
$between_fieldstring[2]field value lies between the values of two other specified fields{system_last_change_at: {$between_field: ["system_created_at","system_delete_at"]}}system_last_change_at BETWEEN system_created_at AND system_delete_at
$notBetween_fieldstring[2]field value not lies between the values of two other specified fields{system_last_change_at: {$notBetween_field: ["system_created_at","system_delete_at"]}}system_last_change_at NOT BETWEEN system_created_at AND system_delete_at
$dateintDate/Time only: day of month equals comparison value{system_created_at: {$date: 1}}DAY(system_created_at) = 1
$dayintDate/Time only: weekday equals comparison value{system_created_at: {$day: 1}}DATEPART(dw, system_created_at) = 1
$yearintDate/Time only: year equals comparison value{system_created_at: {$year: 2000}}YEAR(system_created_at)=2000
$monthintDate/Time only: month equals comparison value{system_created_at: {$month: 12}}MONTH(system_created_at)=12
$minutesintDate/Time only: minute equals comparison value{system_created_at: {$minutes: 59}}DATEPART(mi, system_created_at) = 59
$hoursintDate/Time only: hour equals comparison value{system_created_at: {$hours: 18}}DATEPART(hh, system_created_at) = 18

ALL

Default filter. This filter loads all records without restrictions.
Example:
{$all: true} ≙ select * from tab where 1=1
only true is allowed

EMPTY

This filter creates an empty query. Usually not required.
Example:
{$empty: true} ≙ select * from tab where 1=0
only true is allowed

NOT

This filter negates the included filter
Example:
{$not: {system_id: "7"}} ≙ select * from tab where NOT (sytem_id='7')

AND

This filter connects the contained filters to a logical conjunction (AND)
Example:
{$and: [{vertragsnummer: {$contains: {"123"}}, {vertragsnummer: {$notEquals: "100123100"}}, ...]} ≙ select * from tab where vertragsnummer like '%123%' AND vertragsnummer <> '100123100' AND ...
shorthand: {vertragsnummer: {$contains: {"123"}, vertragsnummer: {$notEquals: "100123100"}, ...}

OR

This filter connects the contained filters to a logical disjunction (OR)
Example:
{$or: [{vertragsnummer: {$contains: {"123"}}, {vertragsnummer: {$notEquals: "100123100"}}, ...]} ≙ select * from tab where vertragsnummer like '%123%' OR vertragsnummer <> '100123100' OR ...

Combination of Shorthands

There are shorthands (see above) for both the $and filter and the $equals comparator, which can be combined.
Example:
{name: "Albrecht", vorname: "Klaus"} ≙ select * from tab where name='Albrecht' AND vorname='Klaus'

Nesting

$and, $or and $not filters can be nested in any way.
Example:
{$or: [{$and: [filter1, filter2], $not: {$or: [filter3, filter4]}]} ≙ select * from tab where (filter1 AND filter2) OR NOT(filter3 OR filter4)