SaveContact

POST SaveContact

URL: /api/Contact/SaveContact

Description 

Save or update Yurbi Contact object. This call will create a new contact or for existing contact update the contact record. This call returns an updated JSON structure with any errors populated in errorCode or ErrorMessage properties. For new contact you can get the JSON structure from the NewContact API (see /api/Contact/NewContact).

Method 

POST

Data Params

{
sessionToken : [string],
user: [user object],
withpin: [boolean]
}

Example

{
  "sessionToken": "RWPPOETPLAPNDZBJPTMAHIWBS",
  "user": {
    "AllApplications": [],
    "AllGroups": [],
    "AllRoles": [],
    "ApplicationConstraints": [],
    "AuthType": "PIN",
    "ComboName": null,
    "CreateDate": "2016-06-15T01:43:52.6372425+00:00",
    "Description": "Sample User",
    "EmailAddress": "[email protected]",
    "ErrorCode": 0,
    "ErrorMessage": null,
    "FirstName": "Smith",
    "FullName": null,
    "ID": null,
    "LastName": "John",
    "LoginDate": "0001-01-01T00:00:00",
    "LoginName": "jsmith",
    "ModifyDate": "2016-06-15T01:43:52.6372425+00:00",
    "Pin": null,
    "Preferences": [],
    "SecurityGroups": [],
    "UserApplications": [],
    "UserState": 0,
    "isAdmin": false,
    "isAgent": false,
    "isArchitect": false,
    "isBuilder": false,
    "isFirstRun": false,
    "isSuperAdmin": false,
    "PIN": "12345"
  },
  "withpin": true
}

Success Response 

Code: 200 

Response will return a user object, if successful ErrorCode should be 0 with ErrorMessage empty. Also, the ID property should contain the new contact record id.

{
  "AllApplications": [],
  "AllGroups": [],
  "AllRoles": [],
  "ApplicationConstraints": null,
  "AuthType": "PIN",
  "ComboName": "John, Smith",
  "CreateDate": "2016-06-15T01:43:52",
  "Description": "Sample User",
  "EmailAddress": "[email protected]",
  "ErrorCode": 0,
  "ErrorMessage": "",
  "FirstName": "Smith",
  "FullName": "Smith John",
  "ID": "636015518654495099",
  "LastName": "John",
  "LoginDate": "0001-01-01T00:00:00",
  "LoginName": "jsmith",
  "ModifyDate": "2016-06-15T01:43:52",
  "Pin": "",
  "Preferences": [],
  "SecurityGroups": null,
  "UserApplications": [],
  "UserState": 0,
  "isAdmin": false,
  "isAgent": false,
  "isArchitect": false,
  "isBuilder": false,
  "isFirstRun": false,
  "isSuperAdmin": false
}

Definition of DashobardListItem

NameDescriptionType
AllApplicationsDescription of Dashboardobject
AllGroupsUnique id of stored dashboard, used to retrieve dashboard for display.object
AllRoles1 if this dashboard is in logged in users’ favorite list.object
Application ConstraintsName of the dashboard.object
AuthTypeSearch list index value.integer
ComboNameRead Only do not set.string
CreateDateCreation Datedate
DescriptionDescription of contact.string
EmailAddressUser’s email address used for scheduled reports.string
ErrorCodeError code.integer
ErrorMessageError messagestring
FirstNameFirst Namestring
FullnameRead Only do not set.string
LoginDateRead Onlydate
LoginNameUser’s loginstring
ModifyDateLast modify date of contact recorddate
PinUser’s password if not using windows authentication. Set only, server will never return this when retrieving contact record for edit.string
PreferencesUser preferences.object
SecurityGroupsList of security groups the user belongs to.object
UserApplicationsList of Yurbi apps user has access to.object
UserStateinteger
isAdminUI Flag only does not give user admin permission.boolean
isAgentUI Flag only does not give user Agent access.boolean
isArchitectUI Flag only does not give user Architect access.boolean
isBuilderUI Flag only does not give user Builder access.boolean
isFirstRunUI Flag only.boolean
isSuperAdminUI Flag only does not give user Super Admin Accessboolean

Sample Call

$.ajax({
  url: "/api/Contact/SaveContact",
  dataType: "json",
    data :{
    "sessionToken": "RWPPOETPLAPNDZBJPTMAHIWBS",
    "user": {
    "AllApplications": [],
    "AllGroups": [],
    "AllRoles": [],
    "ApplicationConstraints": [],
    "AuthType": "PIN",
    "ComboName": null,
    "CreateDate": "2016-06-15T01:43:52.6372425+00:00",
    "Description": "Sample User",
    "EmailAddress": "[email protected]",
    "ErrorCode": 0,
    "ErrorMessage": null,
    "FirstName": "Smith",
    "FullName": null,
    "ID": null,
    "LastName": "John",
    "LoginDate": "0001-01-01T00:00:00",
    "LoginName": "jsmith",
    "ModifyDate": "2016-06-15T01:43:52.6372425+00:00",
    "Pin": null,
    "Preferences": [],
    "SecurityGroups": [],
    "UserApplications": [],
    "UserState": 0,
    "isAdmin": false,
    "isAgent": false,
    "isArchitect": false,
    "isBuilder": false,
    "isFirstRun": false,
    "isSuperAdmin": false,
    "PIN": "12345"
    },
    "withpin": true
  },
  type : "POST",
  contentType: 'application/json; charset=utf-8',
  dataType: 'json',
  async: false,
  error: function(req, status, msg) {
        //do something on error
  },
  success : function(r) {
    objNewContact = msg;
    //do something based on success 
    if (objNewContact.ErrorCode == 0){
      //save action did not return an error
      console.log(objNewContact.FullName + " Save Completed");
    } else {
      //show error
      console.log(objNewContact.ErrorMessage);
    }                                
  }
});

Was this article helpful?

NewPolicy
SearchReports