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
Name | Description | Type |
AllApplications | Description of Dashboard | object |
AllGroups | Unique id of stored dashboard, used to retrieve dashboard for display. | object |
AllRoles | 1 if this dashboard is in logged in users’ favorite list. | object |
Application Constraints | Name of the dashboard. | object |
AuthType | Search list index value. | integer |
ComboName | Read Only do not set. | string |
CreateDate | Creation Date | date |
Description | Description of contact. | string |
EmailAddress | User’s email address used for scheduled reports. | string |
ErrorCode | Error code. | integer |
ErrorMessage | Error message | string |
FirstName | First Name | string |
Fullname | Read Only do not set. | string |
LoginDate | Read Only | date |
LoginName | User’s login | string |
ModifyDate | Last modify date of contact record | date |
Pin | User’s password if not using windows authentication. Set only, server will never return this when retrieving contact record for edit. | string |
Preferences | User preferences. | object |
SecurityGroups | List of security groups the user belongs to. | object |
UserApplications | List of Yurbi apps user has access to. | object |
UserState | integer | |
isAdmin | UI Flag only does not give user admin permission. | boolean |
isAgent | UI Flag only does not give user Agent access. | boolean |
isArchitect | UI Flag only does not give user Architect access. | boolean |
isBuilder | UI Flag only does not give user Builder access. | boolean |
isFirstRun | UI Flag only. | boolean |
isSuperAdmin | UI Flag only does not give user Super Admin Access | boolean |
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);
}
}
});