- https://api.infact.no/{versionNo}/datasources
versionNo - version of API (last version: v1)
Require Bearer Authentication.
Authorization: Bearer <token>
To get a token - use Account API with Basic authorization header
`GET /v1/Account/token
The global data source (GDS) is a database in the NGD platform that belongs to a customer and privately contains only the customer's data.
The global data source object scheme is made based on customers' business models and often repeats customers' CRM system structure, e.g. members_db, visits, contracts, services, contract_types with different relations like by member_id, contract_id.
The global data source may have this structure or another:

Having data in the global data source it’s possible to use it as a source for manual campaigns, automatic repetitive campaigns (Jobs), campaigns via the API, etc. For sending campaigns to different groups of customers is possible to use an advanced Query builder that allows you to filter out subgroups of customers by flexible search criteria that are based on your database fields.
Storing customer data in global data source is vital for using an advanced Infact Survey module, since it allows us to match loyalty scores and survey answers with a specifi
c customer in the Customer DB.
Global data source scheme is created by the Infact support team.
The API allows you to populate global data source by single records or record batches, get single item from DS, use Datasource Import Strategies, get global data source object scheme and create SMS/Email campaigns to groups of recipients selected by Search Queries.
GET /v1/datasources/{datasourceId}/objects/

[ { "Key": "string", "Value": "string" } ]
[ { "Key": "members", "Value": "3387_2" } ]
objectName - “members” will be used as a parameter in the methods below.
GET /v1/datasources/{datasourceId}/objects/{objectName}/properties

`
[
{
"Name": "string",
"Caption": "string",
"Type": "Unknown"
}
]`
``
[
{
"Name": "id",
"Caption": null,
"Type": "Integer"
},
{
"Name": "firstname",
"Caption": "First name",
"Type": "ShortString"
},
{
"Name": "lastname",
"Caption": "Last name",
"Type": "ShortString"
},
{
"Name": "dateOfBirth",
"Caption": "Birthday",
"Type": "Date"
},
{
"Name": "gender",
"Caption": "Gender",
"Type": "ShortString"
},
{
"Name": "phone",
"Caption": "Phone",
"Type": "Mobile"
},
{
"Name": "email",
"Caption": "Email",
"Type": "Email"
},
{
"Name": "address",
"Caption": "Address",
"Type": "String"
},
{
"Name": "zip",
"Caption": "Zip code",
"Type": "Integer"
},
{
"Name": "city",
"Caption": "City",
"Type": "ShortString"
},
{
"Name": "createdDate",
"Caption": "Created Date",
"Type": "Date"
}
]
Returns data source item record by item Id.
GET /v1/datasources/{datasourceId}/objects/{objectName}/data/{itemId}

{
"Prop1": {},
"Prop2": {},
"Prop3": {}
}
GET https://betaapi.infact.no/v1/datasources/265/objects/members/data/12
{
"id": 12,
"firstname": "Maksym 12",
"lastname": "Last name",
"dateOfBirth": null,
"gender": "Gender",
"phone": "+4791901360",
"email": "maksym@infact.no",
"address": "Address",
"zip": 1358,
"city": "Jar",
"createdDate": "2022-06-17T00:00:00"
}
PUT /v1/datasources/{datasourceId}/objects/{objectName}/data/{itemId}

POST /v1/datasources/{datasourceId}/objects/{objectName}/data/

POST https://api.infact.no/v1/datasources/265/objects/members/data
{
"id": 12,
"firstname": "First name",
"lastname": "Last name",
"dateOfBirth": "Birthday",
"gender": "Gender",
"phone": "+4791901360",
"email": "maksym@infact.no",
"address": "Address",
"zip": 1358,
"city": "Jar"
}
POST /v1/datasources/{datasourceId}/objects/{objectName}/data/batch

POST https://api.infact.no/v1/datasources/265/objects/members/data
[
{
"id": 12,
"firstname": "Maksym 12",
"lastname": "Last name",
"dateOfBirth": "Birthday",
"gender": "Gender",
"phone": "+4791901360",
"email": "maksym@infact.no",
"address": "Address",
"zip": 1358,
"city": "Jar"
},
{
"id": 13,
"firstname": "Maksym 13",
"lastname": "Last name",
"dateOfBirth": "Birthday",
"gender": "Gender",
"phone": "+4791901360",
"email": "maksym@infact.no",
"address": "Address",
"zip": 1358,
"city": "Jar"
}
]
POST /v1/datasources/{datasourceId}/objects/{objectName}/data/import/json

{
"Items": [
{}
],
"MergeKey": "string",
"Tags": [
"string"
]
}
Items: Array of objects
MergeKey: Name of field to be used as a key. List of fields that may be used as merge key provided by Infact support
Since key field is not required to be unique, it allows to change mulptiple items with same values, e..g. to add the same tag to all members in certain city, use “city” field as merge key and do not provide any other fields in the Items object
The following settings example sets "HasCityTag" tag to all members in Oslo and Bergen, and also changes zip to 12345 for members in Oslo and to 55321 to members in Bergen
{
"Items": [
{ "city": "Oslo", "zip": 12345 },
{ "city": "Bergen", "zip": 55321 }
],
"MergeKey": "string",
"Tags": [
"HasCityTag"
]
}
Tags: List df Import tags. Every tag in this dictionary will be linked to each item in Items dictionary.
{
"Id": 0,
"TotalCount": 0,
"ImportedCount": 0,
"RowErrorsCount": 0,
"InvalidPropertiesCount": 0,
"ErrorsCount": 0,
"ImportDuration": "string"
}

POST /v1/datasources/{datasourceId}/campaign

{
"Query": {
"ObjectName": "string",
"Name": "string",
"Count": 0,
"Filter": [
{
"Path": "string",
"Operations": [
{
"Predicate": "Equals",
"Value": {},
"MaxValue": {},
"UseOr": true
}
],
"UseOr": true,
"Filters": [
null
]
}
],
"Order": [
{
"Name": "string",
"Direction": "Asc"
}
],
"IsDictionary": true,
"SelfJoin": [
{
"Parent": "string",
"Child": "string",
"Type": "Equals"
}
],
"GroupBy": [
"string"
]
},
"ExternalId": "string",
"Type": "SMS",
"Priority": "SMS",
"Name": "string",
"Description": "string",
"ScheduleDate": "2022-06-21T16:45:07.281Z",
"AllowDuplicates": true,
"SMSTemplateId": 0,
"CountryCode": "string",
"PhoneName": "string",
"EmailName": "string",
"EmailTemplateId": 0,
"EmailSubject": "string",
"SMSBlackList": {
"Type": "None",
"BlackListIds": [
0
],
"FormIds": [
0
]
},
"EmailBlackList": {
"Type": "None",
"BlackListIds": [
0
],
"FormIds": [
0
]
}
}






POST https://api.infact.no/v1/datasources/265/campaign
{
"ExternalId": "externalCampaignID",
"Type": "SMS",
"Priority": "SMS",
"Name": "Camapaign from DS by query via API",
"AllowDuplicates": false,
"PhoneName": "phone",
"CountryCode": "NO",
"ScheduleDate": "2022-06-17 16:10:18",
"SMSTemplateId": 2,
"Query": {
"ObjectName": "members",
"Name": "name of query search",
"Filter": [
{
"Path": "__tags.tag",
"Operations": [
{
"Predicate": "In",
"Value": ["tag5"],
"MaxValue": null,
"UseOr": false
}
],
"UseOr": false
}
]
}
}
"Query": {
"ObjectName": "members",
"Name": "name of query search",
"Filter": [
{
"Path": "__tags.tag",
"Operations": [
{
"Predicate": "In",
"Value": ["tag5"],
"MaxValue": null,
"UseOr": false
}
],
"UseOr": false
}
]
}
In this example, we will import two sets of recipients to the existing data source. The data source scheme is shown below.
[
{
"Name": "id",
"Caption": null,
"Type": "Integer"
},
{
"Name": "firstname",
"Caption": "First name",
"Type": "ShortString"
},
{
"Name": "lastname",
"Caption": "Last name",
"Type": "ShortString"
},
{
"Name": "dateOfBirth",
"Caption": "Birthday",
"Type": "Date"
},
{
"Name": "gender",
"Caption": "Gender",
"Type": "ShortString"
},
{
"Name": "phone",
"Caption": "Phone",
"Type": "Mobile"
},
{
"Name": "email",
"Caption": "Email",
"Type": "Email"
},
{
"Name": "address",
"Caption": "Address",
"Type": "String"
},
{
"Name": "zip",
"Caption": "Zip code",
"Type": "Integer"
},
{
"Name": "city",
"Caption": "City",
"Type": "ShortString"
},
{
"Name": "createdDate",
"Caption": "Created Date",
"Type": "Date"
}
]
POST /v1/datasources/{datasourceId}/objects/{objectName}/data/import/json
{
"Items": [
{
"id": 16,
"firstname": "Maksym 16",
"lastname": "Yakovliev",
"dateOfBirth": "1983-01-01",
"gender": "Gender",
"phone": "+380952579743",
"email": "maksym@infact.no",
"address": "Address",
"zip": 1358,
"city": "Jar"
},
{
"id": 17,
"firstname": "User 17",
"lastname": "lastname",
"dateOfBirth": "1989-01-01",
"gender": "Gender",
"email": "post@example.com",
"address": "Address",
"zip": 1364,
"city": "Jar"
}
],
"MergeKey": "phone",
"Tags": [
"ImportTag7"
]
}
{
"Id": 19866,
"TotalCount": 2,
"ImportedCount": 1,
"RowErrorsCount": 0,
"InvalidPropertiesCount": 0,
"ErrorsCount": 0,
"ImportDuration": "00:00:01.8505410"
}
The record with Id 16 was updated.
The record with Id 17 was added.
- before the import
- after the import