This API is intended only for use by GOSS developers as the first stage in user linking product development. It is liable to change and should not be incorporated into production environments with real users.
This API manages the links that can be created between users. All links are of a type created by userLinking_userLinkTypes.
When a userLink is created an ID is returned in the response. This ID is used in all other methods.
Authentication
All requests need the username and password of an iCM user. These can be provided directly or via an API key's "default credentials".
See End Point this Object for information about supplying an API key when calling a worker from an End Point, API Server Security for information about keys and default credentials, and the methods below for examples.
Logging
Creating, deleting and updating links is recorded in iCM's security log.
Methods
Note that all request parameters are passed to the method in a "payload" object. See the examples below.
userLinking_userLinks_create
Creates a userLink record.
Request Parameters
Name | Type | Description |
---|---|---|
fromUser | Integer | Required. The ID of the user to link from |
toUser | Integer | Required. The ID of the user to link to |
linkType | Integer | Required. The ID of a link type created by userLinking_userLinkTypes |
comment | String | Optional. An optional comment |
function(params, credentials) {
let userLink = this.callWorkerMethod("icmapi", "userLinking_userLinks_create", {
payload: {
fromUser: 69,
toUser: 44,
linkType: 8,
comment: null
}
}, {
options: {
apiKey: "<Your API Key>"
}
});
return userLink;
}
Response - Success
Name | Type | Description |
---|---|---|
id | Integer | An ID for the link |
fromUser | Integer | As supplied |
toUser | Integer | As supplied |
linkType | Integer | As supplied |
comment | String | As supplied |
{
"id": 83,
"result": {
"id": 47,
"fromUser": 69,
"toUser": 44,
"linkType": 8,
"created": "2022-11-30T14:01:43",
"createdByUser": 74,
"comment": null
},
"jsonrpc": "2.0"
}
Response - Error
Message | Description |
---|---|
Conflict | Returned when the link already exists or if the linkType conflicts with the cardinality rules of existing links (see userLinking_userLinkTypes for an explanation of the rules) |
Unprocessable | Returned if the fromUser, toUser or linkType don't exist |
{
"id": "_1",
"error": {
"code": -32602,
"data": "Conflict",
"message": "Conflict"
},
"jsonrpc": "2.0"
}
userLinking_userLinks_delete
Deletes a userLink.
Request Parameters
Name | Type | Description |
---|---|---|
id | Integer | Required. The ID of the userLink to delete |
function(params, credentials) {
let deleteLink = this.callWorkerMethod("icmapi", "userLinking_userLinks_delete", {
payload: {
id: 47
}
}, {
"options": {
apiKey: "<Your API Key>"
}
});
return deleteLink;
}
Response - Success
None.
{
"result": null,
"id": "_1",
"jsonrpc": "2.0"
}
Response - Error
Returned when the userLink couldn't be found.
{
"id": "_1",
"error": {
"code": -32602,
"data": "NotFound",
"message": "NotFound"
},
"jsonrpc": "2.0"
}
userLinking_userLinks_get
Returns a single userLink by ID.
Request Parameters
Name | Type | Description |
---|---|---|
id | Integer | Required. The ID of the userLink |
function(params, credentials) {
let userLink = this.callWorkerMethod("icmapi", "userLinking_userLinks_get", {
payload: {
id: 45
}
}, {
options: {
apiKey: "<Your API Key>"
}
});
return userLink;
}
Response - Success
The requested userLink.
Name | Type | Description |
---|---|---|
id | Integer | The link ID |
fromUser | Integer | The ID of the user to linked from |
toUser | Integer | The ID of the user to linked to |
linkType | Integer | The ID of the link type created by userLinking_userLinkTypes |
created | String | The date and time the link was created |
createdByUser | Integer | The ID of the iCM user who created this link - this will be the ID of the user supplied as default worker credentials if using an API key |
comment | String | The comment added when the link was created |
{
"id": 236,
"result": {
"id": 45,
"fromUser": 44,
"toUser": 142,
"linkType": 8,
"created": "2022-11-30T13:36:17",
"createdByUser": 74,
"comment": null
},
"jsonrpc": "2.0"
}
userLinking_userLinks_getAll
Gets all userLinks that match the supplied filters and paging.
Request Parameters
Name | Type | Description |
---|---|---|
filters | Object | Optional. Not setting a filter (or providing an empty filter object) will return all userLinks |
filters.fromUsers | Array <integer> | Returns all of the links from these users |
filters.toUsers | Array <integer> | Returns all of the links to these users |
filters.linkTypes | Array <integer> | Returns all of the links between users of this type |
pagination | Object | Optional. The start position and length of results to return |
pagination.start | Integer | The start position (zero based) |
pagination.length | Integer | The number to return |
This example returns all of the links from the two users.
function(params, credentials) {
let getAll = this.callWorkerMethod("icmapi", "userLinking_userLinks_getAll", {
payload: {
filters: {
fromUsers: [142, 71]
},
pagination: {}
}
}, {
options: {
apiKey: "<Your API Key>"
}
});
return getAll;
}
This example returns the first two userLinks of type 8.
function(params, credentials) {
let getAll = this.callWorkerMethod("icmapi", "userLinking_userLinks_getAll", {
payload: {
filters: {
linkTypes: [8]
},
pagination: {
start: 0,
length: 2
}
}
}, {
options: {
apiKey: "<Your API Key>"
}
});
return getAll;
}
Response - Success
An array of userLinks that match the filters and pagination, where each userLink has the following properties.
Name | Type | Description |
---|---|---|
id | Integer | The link ID |
fromUser | Integer | The ID of the user to linked from |
toUser | Integer | The ID of the user to linked to |
linkType | Integer | The ID of the link type created by userLinking_userLinkTypes |
created | String | The date and time the link was created |
createdByUser | Integer | The ID of the iCM user who created this link - this will be the ID of the user supplied as default worker credentials if using an API key |
comment | String | The comment added when the link was created |
{
"id": 266,
"result": [{
"id": 43,
"fromUser": 142,
"toUser": 71,
"linkType": 8,
"created": "2022-11-30T13:32:13",
"createdByUser": 74,
"comment": null
}, {
"id": 44,
"fromUser": 71,
"toUser": 142,
"linkType": 8,
"created": "2022-11-30T13:32:34",
"createdByUser": 74,
"comment": null
}],
"jsonrpc": "2.0"
}
userLinking_userLinks_update
Updates an existing userLink. The payload is the same as that of create, with the addition of the ID of the userLink to update.
When updating, all existing links to and from the user are checked and the update will fail if the new link's cardinality would violate existing links.
Request Parameters
Name | Type | Description |
---|---|---|
id | Integer | Required. The ID of the userLink to update |
fromUser | Integer | Required. The ID of the user to link from |
toUser | Integer | Required. The ID of the user to link to |
linkType | Integer | Required. The ID of a link type created by userLinking_userLinkTypes |
comment | String | Optional. An optional comment |
function(params, credentials) {
let userLink = this.callWorkerMethod("icmapi", "userLinking_userLinks_update", {
payload: {
"id": 43,
"fromUser": 69,
"toUser": 44,
"linkType": 1,
"comment": null
}
}, {
options: {
apiKey: "<Your API Key>"
}
});
return userLink;
}
Response - Success
None.
{
"result": null,
"id": "_1",
"jsonrpc": "2.0"
}
Response - Error
In this example the link didn't exist.
{
"id": "_1",
"error": {
"code": -32602,
"data": "Unprocessable",
"message": "Unprocessable"
},
"jsonrpc": "2.0"
}