Skip to main content

API: Error When Creating a User Relationship

The Error Doesn't Mean a Missing Field, But an Unresolvable Link — Three Causes

Written by Petr Pech

Importing a user link fails with an error even though both evidenceType and object are filled in in the request:

Při vytváření vazby je nutno zadat 'evidenceType' a 'object'.

The message is misleading — it doesn't mean the fields are missing, but that ABRA Flexi couldn't build a reference to an existing record from them.


Three causes

Cause

How to recognize it

The referenced record doesn't exist.

The value object can't be found in the given register — for example, an external identifier that doesn't exist in ABRA Flexi.

Invalid value evidenceType.

This must be the machine name of the register, for example cenik or faktura-vydana. The list is provided by /c/{firma}/evidence-list.xml.

Incorrect JSON structure.

In JSON, link objects belong directly inside the uzivatelske-vazby field. If you add another level, uzivatelska-vazba (as is written in XML), Flexi won't see the values and will report the same error.


Correct syntax

In JSON, without a nested wrapper:

{
"winstrom": {
"@version": "1.0",
"faktura-vydana": [{
"id": "ext:RNT:2429273",
"uzivatelske-vazby": [{
"vazbaTyp": "code:FAV_OBP",
"evidenceType": "objednavka-prijata",
"object": "ext:RNT:12400246"
}]
}]
}
}

In XML, on the other hand, the uzivatelska-vazba level is included:

<winstrom version="1.0">
<faktura-vydana>
<id>ext:RNT:2429273</id>
<uzivatelske-vazby>
<uzivatelska-vazba>
<vazbaTyp>code:FAV_OBP</vazbaTyp>
<evidenceType>objednavka-prijata</evidenceType>
<object>ext:RNT:12400246</object>
</uzivatelska-vazba>
</uzivatelske-vazby>
</faktura-vydana>
</winstrom>

⚠️ If all three points check out and the import still fails, you'll get a different message — Zvolená kombinace objektů není na vybraném typu vazby přípustná. This means the selected link type doesn't connect this pair of registers; the types are listed in the typ-uzivatelske-vazby register.


Related

Did this answer your question?