Introduction
This is a customer ask, that I will implement via the factory api. We would like an overview of the schedule status of scheduled integrations, e.g. -
{
"Schedules" : [ {
"project_id" : "AA_PROJECT2",
"integration_id" : "LOADNEWORDERS|01.00.0000",
"scheduleCreated" : false,
"scheduleActive" : "No schedule defined"
}, {
"project_id" : "AA_PROJECT2",
"integration_id" : "CONCURRENTASYNCR_CLONE|01.00.0000",
"scheduleCreated" : true,
"scheduleActive" : "CANCELLED"
}, {
"project_id" : "AA_PROJECT2",
"integration_id" : "CONCURRENTASYNCREQUESTS|01.00.0000",
"scheduleCreated" : true,
"scheduleActive" : "ACTIVE"
}...
Using the Factory APIs to retrieve the salient data
First step is to retrieve projects -
Then, for each project, get the scheduled integrations and check if they have active schedules.
My demo project, AA_PROJECT2, contains the following 3 scheduled integrations -
The first integration,
loadNewOrders, has no schedule attached to it.
ConcurrentAsyncRequests_Clone has a schedule, but it is stopped.
ConcurrentAsyncRequests has a schedule attached and it is started.
Now to the api -
I execute this an get the following response for loadNewOrders -
{
"code": "LOADNEWORDERS",
...
"id": "LOADNEWORDERS|01.00.0000",
...
"name": "loadNewOrders",
"pattern": "Scheduled",
"patternDescription": "Scheduled",
"payloadTracingEnabledFlag": false,
"percentageComplete": 100,
"projectId": "AA_PROJECT2",
"projectType": "DEVELOPED",
"recordEnabledFlag": false,
"scheduleApplicableFlag": true,
"scheduleDefinedFlag": false,
"scope": "Private",
"smartTags": "style:scheduled orchestration",
"softDeactivated": false,
"status": "ACTIVATED",
...
"version": "01.00.0000"
},
Here is the extract for ConcurrentAsyncRequests_Clone -
{
"code": "CONCURRENTASYNCR_CLONE",
...
"id": "CONCURRENTASYNCR_CLONE|01.00.0000",
...
"lockedFlag": false,
"name": "ConcurrentAsyncRequests_Clone",
"pattern": "Scheduled",
"patternDescription": "Scheduled",
"payloadTracingEnabledFlag": false,
"percentageComplete": 100,
"projectId": "AA_PROJECT2",
"projectType": "DEVELOPED",
"recordEnabledFlag": false,
"scheduleApplicableFlag": true,
"scheduleDefinedFlag": true,
"scope": "Private",
...
"softDeactivated": false,
"status": "ACTIVATED",
"style": "FREEFORM",
"styleDescription": "Orchestration",
...
"version": "01.00.0000"
},
Here we see that scheduleDefinedFlag has been set to true.
Now to getting the status of the schedule -
https://yourOIC/ic/api/integration/v1/projects/AA_PROJECT2/integrations/CONCURRENTASYNCREQUESTS|01.00.0000/schedule?integrationInstance=yourOICInstance{
... "frequency": {
"frequencyType": "DAILY",
"interval": 1
},
"id": "Schedule_CONCURRENTASYNCREQUESTS_01_00_0000",
...
"scheduleTZ": "Europe/Berlin",
"scheduleTZDisplayName": "Central European Standard Time",
"scheduleType": "BASIC",
"startDate": "2025-11-17|12:54:29",
"state": "ACTIVE",
...
}
The field, state can have the following values -
- ACTIVE
- CANCELLED - denotes the schedule has been stopped. This value is also returned if I create a schedule and do not start it.
What happens if I invoke the above api and the integration does not have a schedule defined?
{
"status": "HTTP 404 Not Found",
"title": "Schedule is not found.",
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"
}
I will invoke all of these in an integration, and, for this invoke, I'll need to catch the above fault.
Invoking the APIs from an Integration
Now let's use these apis in an integration - for this I create a sync app driven integration. I've defined the following request / response payloads -
{
"Schedules" : [ {
"project_id" : "1",
"integration_id" : "NiallC",
"scheduleCreated" : true,
"scheduleActive" : "Active"
}, {
"project_id" : "1",
"integration_id" : "NiallC",
"scheduleCreated" : true,
"scheduleActive" : "Active"
}, {
"project_id" : "1",
"integration_id" : "NiallC",
"scheduleCreated" : true,
"scheduleActive" : "Active"
} ]
}
The first actions are as follows -
Here is the SWITCH route when user has set
allProjects to true in the request payload -
Invoke 1 retrieves projects, then, I iterate over each project and do invoke 2, getProjectIntegrations -
For each integration, here I switch on scheduled integrations -
I include a scope, for retrieving the schedule state -
I assign the state - No Schedule Defined - in the Fault Handler.
I then append the response for this integration to a global variable via Data Stitch -
So which global variables do we require?
Note the use of
Append in the data stitch for the complex structure -
I run the integration and get the following response -
{
"Schedules" : [ {
"project_id" : "AA_PROJECT2",
"integration_id" : "LOADNEWORDERS|01.00.0000",
"scheduleCreated" : false,
"scheduleActive" : "No schedule defined"
}, {
"project_id" : "AA_PROJECT2",
"integration_id" : "CONCURRENTASYNCR_CLONE|01.00.0000",
"scheduleCreated" : true,
"scheduleActive" : "CANCELLED"
}, {
"project_id" : "AA_PROJECT2",
"integration_id" : "CONCURRENTASYNCREQUESTS|01.00.0000",
"scheduleCreated" : true,
"scheduleActive" : "ACTIVE"
}...
No comments:
Post a Comment