External Data Sources (e.g. CRM)
Last updated
Last updated
atfinity allows you to connect external instance data sources so users can copy values from those directly.
To connect an external data source, follow these steps:
Specify your Data Source under Administration -> Data Sources First, name the data source for a certain ontology and create it. Then specify the urls where atfinity should send list and retrieve requests. A list request should return a selection of instances where users can copy values from. A retrieve request returns values for a single instance.
Specify the data source for an ontology Open any ontology under configuration -> ontologies. Under "External Data Source" mention the source you have just created.
atfinity will append ?q=QUERY
to the url specified for the list request and make a GET request to this url. So specifying https://api.yourcrm.com/api/search_person
would make a request tohttps://api.yourcrm.com/api/search_person?q=QUERY
, where QUERY will be replaced with a url-encoded version of the user entered query.
atfinity expects to receive JSON looking like this. The name
will be displayed to the user and the identifier
will be used for the retrieve request. The details
part needs to be provided only if "Enable Detail Column" is set to "Yes". All three can be arbitrary strings.
atfinity handles pagination of the returned instance list if necessary. At a time, usually only 20 entries will be displayed. In the meta.pagination
part of the response atfinity expects those values:
When used navigate to the next page, these extra query parameters will be included in the request:
If you would not like to handle pagination, you could just always return less than page_size
(usually 20) elements and fix page
and pages
to 1.
atfinity will append the value of IDENTIFIER
acquired in the list request to the url and make a GET request to this url. So specifying https://api.yourcrm.com/api/person/
would make a request tohttps://api.yourcrm.com/api/person/IDENTIFIER
.
atfinity expects to receive JSON looking like this. All the values within data
will be tried to match to information keys of the ontology of the instance this request has been made for.
Provided values need to be serialised in the same manner as values provided via our API. For most types using the default JSON format serialisation is just enough, so e.g. {"firstname": "string"}
, {"number_of_children": 2}
, {"weight": 73.4}
or {"has_been_screened": true}
.
Text, Number, Boolean: Default JSON format
Enum: Provide the key of the chosen value as a string, e.g. germany
Multi Enum: Provide the ticked possible values in an array (either json encoded or not), like this: ["inherited", "real_estate_sale"]
Unit, Unit per Item: Provide a dictionary with three entries like so: {"decimal_value": 1000, "item": null, "unit": "chf"}
Errors resulting from atfinity sending you values that you cannot or do not want to process should be handled mostly via HTTP Status Codes. atfinity will try to give users nice message for the following status codes:
Code | Description |
---|---|
Key
Value
Content-Type
application/json