Article last updated on the 3rd of October 2023.
Note that the information in this article relates to version 3 of WorkPoint 365 only.
Contents
1. Introduction
Jobs are essential to the performance of WorkPoint 365 solutions. Jobs relate to a wide range of features and functionalities in WorkPoint, and together with job queues they are responsible for actions being able to be carried out in the WorkPoint system.
Examples of jobs could be Site Creation jobs, Action Management jobs such as Entity Creation or Stage Changing, and Site Maintenance or Security Replication jobs.
Jobs can be started in two different ways: through a button on either the WorkPoint solution or the WorkPoint Administration, or through the two WorkPoint APIs.
In this article, we will cover how to start jobs through the different APIs and the implications hereof.
Once a job is started, it is put into one of two available queues; the standard job queue or the Integration job queue, depending on which job is started and by which method.
In the standard job queue, jobs have various priorities. Aggregation jobs, for example, are categorized as Low Priority, while Security Replication jobs are categorized as High Priority.
The Integration queue is a separate queue typically used for integration and migration related jobs, such as Site Creation jobs. The Integration queue exists such that integration and migration related jobs can be queued without blocking execution of other important jobs running on the WorkPoint solution.
2. Requirements
There are currently no license requirements associated with the ability to start jobs through WorkPoint's APIs.
3. Starting jobs through APIs
WorkPoint jobs can be started through WorkPoint's APIs by calling different HTTP GET or POST requests.
As previously mentioned, WorkPoint has two APIs: the standard WorkPoint API and the Integration API.
These APIs are identical in which jobs and which data can be called or pulled through them, but they differ in which job queue they place jobs in. The standard WorkPoint API places jobs in the standard job queue, while the Integration API places jobs in the Integration queue.
The two job queues are separated to make sure that heavy jobs can be queued and executed while not blocking smaller but still important jobs from running. An example of this could be a large import job when doing data migration or exports, which can take a long time. This job could be started through the Integration API and run from the Integration queue. This would mean that other jobs can still run on the WorkPoint solution from the standard WorkPoint job queue.
Which jobs can be started and which data that can be pulled using the WorkPoint APIs can be inspected here:
WorkPoint API:
https://wp365webapi.azurewebsites.net/Help
Integration API:
http://wp365integration.azurewebsites.net/Help
For examples of how to call the APIs and for more information about the APIs, please visit our GitHub page: https://github.com/WorkPoint-A-S/WorkPointSamples
To run jobs through the Integration API, you first need to set up a Daemon application. You can read more about this process here.
After the Daemon application has been set up, you can run commands against the Integration API by using the API Proxy found in the GitHub page posted above.
Here are a couple of examples of how the jobs can be started through the Integration API:
Get Business Module:
WorkPointAPI workPointAPI = new WorkPointAPI(WorkPointAPI.Mode.Integration, TenantID, WorkPointUrl, ClientID, ClientSecret);
BusinessModuleOnline[] businessModules = await workPointAPI.GetBusinessModules();
Create item with site:
bool createSite = true;
List<FieldValue> fieldValues = new List<FieldValue>();
fieldValues.Add(new FieldValue("Title", "My Company Title"));
ListItemAPI listItemAPI = new ListItemAPI(WorkPointAPI.Mode.Integration, TenantID, WorkPointUrl, ClientID, ClientSecret);
listItemAPI.TimeOutInMilliseconds = 1000 * 60 * 5; // 5 minutes
int itemId = await listItemAPI.Create("Companies", fieldValues.ToArray(), createSite);
Update item:
int itemId = 2;
List<FieldValue> fieldValues = new List<FieldValue>();
fieldValues.Add(new FieldValue("Title", "New Company Title"));
ListItemAPI listItemAPI = new ListItemAPI(WorkPointAPI.Mode.Integration, TenantID, WorkPointUrl, ClientID, ClientSecret);
int returnVal = await listItemAPI.Update("Companies", itemId, fieldValues.ToArray());
Queue Site Creation job:
int itemId = 2;
Guid businessModuleId = new Guid("7A814FF0-251A-43A7-8B65-F57B1E408CDF");
CreateDeleteSitesCommand createSiteCommand = new CreateDeleteSitesCommand() { BusinessModuleId = businessModuleId, ItemIds = new int[] { itemId }};
WorkPointAPI WorkPointAPI = new WorkPointAPI(WorkPointAPI.Mode.Integration, TenantID, WorkPointUrl, ClientID, ClientSecret);
var response = await WorkPointAPI.SendRequest("Command/CreateSites", createSiteCommand);
4. Notes
Note that, for the Integration job queue, you can define how many concurrent jobs that can be run during daytime and nighttime (currently based on Azure Europe West data center time zone). This can be used to address throttling during long integration and/or migration. These settings can be set in the Job Queue Manager settings in the WorkPoint Administration:
Comments
0 comments
Please sign in to leave a comment.