Using data models

Data models

If you wish to return the field values for a Synergist table, for one or more records, you will typically call the appropriate API and specify the data model required. All the key tables will have two standard models available
list model
details model

If you require multiple records you would normally specify the list model. If you require the data for a single record you would normally specify the details model (which returns more fields than the list model).

Note: If you don't specify a model in your call the system will return a default model. If a single record is returned the details model will be used, if multiple records are returned the list model will be used.

Example - Activities

e.g using the activities.json API to return activity records.

  • activitylist
  • activitydetails

A single record is returned if the ‘activityid’ parameter is passed. If a list of records is required a ‘view’ parameter should be passed. If no ‘view’ parameter is passed all records for the synergist company are returned.

ParameterDescriptionExamples
APIThe API areaactivities.json
ActionNot required
Parameters described in overviewuser=user&password=user&version=3.8
CompanyThe company contextcompany=1
StyleWhich kind of data is requiredstyle=modelstructure / style=modeldata (default)
ModelstructureName of model requiredModelstructure=activitylist / Modelstructure=activitydetails
ResponseReturned dataA JSON string containing the data

Example 1
Request for data (list of records using specified model)

http://<SERVER>/jsonapi/activities.json?company=1&version=3.8&user=user&password=user&style=modeldata&modelstructure=activitylist&rows=2&page=1

Example response (activitylist model):

{
  "responsecode": 1,
  "responsestatus": "OK",
  "errorcode": 0,
  "errormessage": "",
  "totalrows": 98,
  "totalpages": 49,
  "responsemessage": "",
  "pagerows": 2,
  "pagenumber": 1,
  "success": true,
  "data": [
    {
      "activityuuid": "A2905F5303AB5943B4D5E00E547B2CF5",
      "activityTimeStampModified": 1445948375,
      "activityRecordVersionNumber": 9,
      "activityAttachmentCount": "1",
      "activityCreated": "Created by SYN_Jon on 22/04/2015 at 1:02pm",
      "activityDetails1stLIne": "",
      "activityRegardingDescription": "",
      "activityRegardingDescription2": "",
      "activityRegardingWhat": "Campaign: jon test",
      "activityPriorityDescription": "High",
      "activityOwnerID": 256,
      "activityOwnerName": "SYN_Jimish",
      "activityClientCode": "",
      "activityClientName": "",
      "activityCompleted": true,
      "activityViewDate": "0000-00-00",
      "activityViewTime": "00:00:00",
      "activityViewTimezone": "",
      "activityJobNumber": "",
      "activityJobNumberSimple": "",
      "activityJobAndPhase": "",
      "activityJobAndPhaseSimple": "",
      "activitySubject": "jon test",
      "activityActivitytype": "Email Export",
      "activityID": 6161
    }
    ]
}

Example 2
Request for data (typically a single record using specified model)

http://<SERVER>/jsonapi/activities.json?company=1&version=3.8&user=user&password=user&style=modeldata&modelstructure=activitydetails&Activityid=6712

Example response (activitydetails model):

{
  "responsecode": 1,
  "responsestatus": "OK",
  "errorcode": 0,
  "errormessage": "",
  "totalrows": 211,
  "totalpages": 106,
  "responsemessage": "",
  "pagerows": 2,
  "pagenumber": 1,
  "success": true,
  "data": [
    {
      "activityuuid": "6D7106089ADDF04DBCFB08F6E8DA0E77",
      "activityTimeStampModified": 1493799916,
      "activityRecordVersionNumber": 45,
      "activityAlertBeforePeriodDescription": "",
      "activityJobPhaseDescription1stLine": "",
      "activityJobDescription1stLine": "",
      "activityCompletedDescription": "",
      "activityCreated": "Created by SYN_Keith White on 17/03/2016 at 4:22pm",
      "activityDetails1stLine": "",
      "activityHistorySummary": "03/05/17 9:24am - Document 'Std letter 1' deleted. ",
      "activityMailshotResponse": "",
      "activityModified": "Last modified by SYN_Jon on 03/05/2017 at 9:25am",
      "activityRegardingDescription": "",
      "activityRegardingDescription2": "",
      "activityRegardingWhat": "Campaign: Blah",
      "activitySecondaryOwnersDescription": [
        
      ],
      "activitySecondaryOwnersUserID": [
        
      ],
      "activityPriorityDescription": "High",
      "activityTimeDueDisplay": "12:00 AM",
      "activityCompanyName": "The Professional Services Company",
      "activityCompanyNumber": 1,
      "activityID": 6712,
      "activityJobNumber": "",
      "activityJobNumberSimple": "",
      "activityJobAndPhase": "",
      "activityJobAndPhaseSimple": "",
      "activityStageCode": "",
      "activityStageDescription": "",
      "activitySubject": "Blah",
      "activityDetails": "",
      "activityClientCode": "",
      "activityClientName": "",
      "activityClientPhone": "",
      "activityActivitytypeCode": "PUP",
      "activityActivitytype": "Public todo2",
      "activityActivitytypeCompanyNumber": 1,
      "activityActivitytypeCategory": 2,
      "activityTeamCode": "",
      "activityTeamDescription": "",
      "activityOwnerID": 4,
      "activityOwnerName": "SYN_Keith White",
      "activityCompletedBy": "",
      "activityCreatedBy": "SYN_Keith White",
      "activityLastModifiedBy": "SYN_Jon",
      "activityClientContactInternalRef": 0,
      "activityClientContactFullName": "",
      "activityStatus": "",
      "activityPriorityID": 1,
      "activityCategory": "blue",
      "activityAlertSentBefore": false,
      "activityAlertBeforePeriod": 0,
      "activityImmediateAlert": true,
      "activityAlertCompleted": false,
      "activityCompleted": false,
      "activityAlertSentInstant": true,
      "activityMarketingCampaignID": 474,
      "activityMarketingCampaignPromotionCode": "",
      "activityDateDue": "0000-00-00",
      "activityTimeDue": "00:00:00",
      "activityDueTimezone": "",
      "activityCompletedByUserID": 0,
      "activityCompletedDate": "0000-00-00",
      "activityCompletedTime": "00:00:00",
      "activityCompletedTimeZone": "",
      "activityTimezoneCompleted": "",
      "activityTimezoneCreated": "GMT",
      "activityTimezoneLastModified": "GMT",
      "activityCreatedByUserID": 4,
      "activityCreationDate": "2016-03-17",
      "activityCreationTime": "16:22:53",
      "activityCreationTimeZone": "UTCA",
      "activityLastModifiedByUserID": 3,
      "activityLastModifiedDate": "2017-05-03",
      "activityLastModifiedTime": "09:25:16",
      "activityLastModifiedTimeZone": "UTCA"
    }
    ]
}