Create and Get Knowledge Alerts Using the API
Create a KNowledge Alert
POST api/v1/alerts
To create a knowledge alert, you will need the cardId
of the card that you are alerting users to read. You will also need the id
of at least one group that should be alerted. You may add more than one object to the groups
array if you need to notify several groups. OPTIONALLY, you may include a parameter called note
to send additional information to the group you are alerting.
An example of the minimum required request payload for creating a Knowledge Alert is sampled here:
{
"cardId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"groups": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}],
"note": "Please read this card to check its accuracy!"
}
Get delegated knowledge alerts
GET /api/v1/alerts
There is no endpoint to get just one Knowledge Alert by its ID. Instead, this call will retrieve all delegated Knowledge Alerts with all of their associated information. Inside of a single object, the readCount
, unreadCount
, and percentRead
attributes can be accessed.
With this call, you may add URL query parameters to sort the list of all Knowledge Alerts. Here is an example:
api/v1/alerts?sortField=dateSent&sortOrder=DESC
sortField
can be set to dateSent
, percent
, or cardTitle
Note: Listing Knowledge Alerts may return paginated lists if alerts are assigned frequently
Here is an example of one Knowledge Alert object:
{
"alertId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"cardTitle": "Skateboard",
"dateSent": "2019-03-25T21:09:20.620+0000",
"collectionHexColor": "#f44336",
"groups": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"numberOfCardsAsVerifier": 0,
"numberOfMembers": 0,
"modifiable": false
},
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"numberOfCardsAsVerifier": 0,
"numberOfMembers": 0,
"modifiable": false
}
],
"readCount": 1,
"unreadCount": 3,
"percentRead": 25,
"card": {
"content": "<p class=\"ghq-card-content__paragraph\" data-ghq-card-content-type=\"paragraph\">skateboard </p>",
"owner": {
"status": "ACTIVE",
"email": "bcumens@getguru.com",
"firstName": "Brittany",
"lastName": "Cumens",
"profilePicUrl": "/assets/common/images/default-user-pic.png"
},
"lastModified": "2019-03-18T20:36:36.114+0000",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"slug": "inEe8LyT/Skateboard",
"teamId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"dateCreated": "2019-03-18T20:36:36.114+0000",
"collection": {
"color": "#f44336",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"slug": "p6a1j/Information",
"collectionType": "INTERNAL",
"name": "Information"
},
"lastVerified": "2019-03-18T20:36:36.342+0000",
"lastVerifiedBy": {
"status": "ACTIVE",
"email": "bcumens@getguru.com",
"firstName": "Brittany",
"lastName": "Cumens",
"profilePicUrl": "/assets/common/images/default-user-pic.png"
},
"lastModifiedBy": {
"status": "ACTIVE",
"email": "bcumens@getguru.com",
"firstName": "Brittany",
"lastName": "Cumens",
"profilePicUrl": "/assets/common/images/default-user-pic.png"
},
"htmlContent": true,
"shareStatus": "TEAM",
"preferredPhrase": "This is a card about a Skateboard",
"verificationInterval": 365,
"verificationState": "TRUSTED",
"cardType": "CARD",
"nextVerificationDate": "2020-03-17T20:36:36.342+0000"
}
}