Skip to main content

Tutorial

In this tutorial, we use the Asprova My Schedule / WS public API from a Node.js environment to retrieve operation information from a plan built in Asprova (1), and to enter results against those operations (2).

  1. /api/asprova/v0/projects/{projectId}/schedule/operations
  2. /api/asprova/v0/projects/{projectId}/transactions/results

Prerequisites

  • Knowledge of JavaScript
  • A Node.js runtime
  • Asprova (ver.18.0 or later) is installed
  • Asprova My Schedule (ver.26.1.4 or later) has been set up

Preparation

warning

Note that the Asprova My Schedule server must be either not license-authenticated or authenticated with a demo license. If the Asprova My Schedule server is authenticated with a full license, license restrictions may cause use of the public API to fail.

Access Asprova My Schedule and create a new project API Test as a Free-plan project. Make a note of the ID assigned to the project you created.

Open the detailed settings screen of the API Test project, check "Operation Table" and "Resource Gantt Chart" under the UI settings, and save. Only the Operation Table upload is required to use the API, but let's also upload the Resource Gantt Chart and keep it viewable so we can check the state of result entry.

In this tutorial, the Aru file to upload is the standard sample "1-1 Filling" (as1.aru). Open as1.aru in Asprova and configure the My Schedule integration settings. Select API Test as the integration target project and configure it to upload the Operation Table. At this time, choose the "Standard" style for both the Operation Table and the Resource Gantt Chart. Also, specify "Assignment start time + 14 days" as the upload period. After that, upload to My Schedule.

Retrieving the Operation Table via the API

const serverLocation = "http://localhost"
const projectId = "(API Test project's ID)"

const operations = await fetch(serverLocation + `/api/asprova/v0/projects/${projectId}/schedule/operations`, {
headers: {
"x-asprova-ws-api-key": "4@bBbq7V#53Jvq9Wfcm" // this is the default API key
}
}).then(res => res.json())

console.log(operations.find(op => op.Work_Code === "2:10"))

The content of the operation with code "2:10" is shown. The properties included are those specified in the "Standard" style.

{
"Work_Code": "2:10",
"Work_Bom": "材料混合",
"Work_OperationOutMainItem": "製品A-10",
"Work_OperationOutMainItemQty": "30",
"Work_OperationMainRes": "混合1",
"Work_OperationProductionStartTime": "2028/06/01 08:10:00",
"Work_OperationProductionEndTime": "2028/06/01 15:43:00",
"Work_OperationProductionTime": "7h33m",
"Work_OperationSetupStartTime": "2028/06/01 08:00:00",
"Work_OperationSetupEndTime": "2028/06/01 08:10:00",
"Work_OperationSetupTime": "10m",
"Work_OperationTeardownStartTime": "2028/06/01 15:43:00",
"Work_OperationTeardownEndTime": "2028/06/01 15:53:00",
"Work_OperationTeardownTime": "10m",
"Work_LeadTime": "7h53m",
"Work_StartTime": "2028/06/01 08:00:00",
"Work_EndTime": "2028/06/01 15:53:00",
"Work_TotalCalculatedEST": "2028/06/01 00:00:00",
"Work_TotalCalculatedLET": "2028/06/01 15:43:00",
"Work_Earliness": "",
"Work_Lateness": "0s",
"Work_IsAssigned": "1",
"Work_AssignmentDirection": "F",
"Work_Status": "A",
"Work_ResultStartTime": "",
"Work_ResultEndTime": "",
"Work_ResultQty": "",
"Work_PrevOperation": "",
"Work_NextOperation": "2:20"
}

Entering results in My Schedule

In My Schedule, open the Resource Gantt Chart of the API Test project, select 2:10, and press the "Start" and "Finish" buttons in order on the timeline to complete the operation.

If you retrieve the Operation Table from the API again, the operation's status and result start time have been filled in.

{
"Work_Code": "2:10",
"Work_Bom": "材料混合",
"Work_OperationOutMainItem": "製品A-10",
"Work_OperationOutMainItemQty": "30",
"Work_OperationMainRes": "混合1",
"Work_OperationProductionStartTime": "2028/06/01 08:10:00",
"Work_OperationProductionEndTime": "2028/06/01 15:43:00",
"Work_OperationProductionTime": "7h33m",
"Work_OperationSetupStartTime": "2028/06/01 08:00:00",
"Work_OperationSetupEndTime": "2028/06/01 08:10:00",
"Work_OperationSetupTime": "10m",
"Work_OperationTeardownStartTime": "2028/06/01 15:43:00",
"Work_OperationTeardownEndTime": "2028/06/01 15:53:00",
"Work_OperationTeardownTime": "10m",
"Work_LeadTime": "7h53m",
"Work_StartTime": "2028/06/01 08:00:00",
"Work_EndTime": "2028/06/01 15:53:00",
"Work_TotalCalculatedEST": "2028/06/01 00:00:00",
"Work_TotalCalculatedLET": "2028/06/01 15:43:00",
"Work_Earliness": "",
"Work_Lateness": "0s",
"Work_IsAssigned": "1",
"Work_AssignmentDirection": "F",
"Work_Status": "B",
"Work_ResultStartTime": "2026/03/06 10:08:37",
"Work_ResultEndTime": "2026/03/06 10:08:38",
"Work_ResultQty": "",
"Work_PrevOperation": "",
"Work_NextOperation": "2:20"
}

Entering results via the API

Next, let's enter results through the API.

We'll set the status of operation "2:20" to Started and its result quantity to 10.

const serverLocation = "http://localhost"
const projectId = "(API Test project's ID)"

const response = await fetch(serverLocation + `/api/asprova/v0/projects/${projectId}/transactions/results`, {
method: "POST",
body: JSON.stringify({
"2:20": {
Work_Status: "T",
Work_ResultQty: 10
}
}),
headers: {
"Content-Type": "application/json",
"x-asprova-ws-api-key": "4@bBbq7V#53Jvq9Wfcm" // this is the default API key
}
})

console.log(response.ok)

If you retrieve the state of operation "2:20" using /api/asprova/v0/projects/{projectId}/schedule/operations, you get the following.

{
"Work_Code": "2:20",
"Work_Bom": "充填",
"Work_OperationOutMainItem": "製品A-20",
"Work_OperationOutMainItemQty": "30",
"Work_OperationMainRes": "充填1",
"Work_OperationProductionStartTime": "2028/06/01 17:43:00",
"Work_OperationProductionEndTime": "2028/06/02 08:07:00",
"Work_OperationProductionTime": "5h24m",
"Work_OperationSetupStartTime": "2028/06/01 15:43:00",
"Work_OperationSetupEndTime": "2028/06/01 17:43:00",
"Work_OperationSetupTime": "2h",
"Work_OperationTeardownStartTime": "",
"Work_OperationTeardownEndTime": "",
"Work_OperationTeardownTime": "",
"Work_LeadTime": "16h24m",
"Work_StartTime": "2028/06/01 15:43:00",
"Work_EndTime": "2028/06/02 08:07:00",
"Work_TotalCalculatedEST": "2028/06/01 17:43:00",
"Work_TotalCalculatedLET": "2028/06/02 08:07:00",
"Work_Earliness": "0s",
"Work_Lateness": "0s",
"Work_IsAssigned": "1",
"Work_AssignmentDirection": "F",
"Work_Status": "T",
"Work_ResultStartTime": "",
"Work_ResultEndTime": "",
"Work_ResultQty": 10,
"Work_PrevOperation": "2:10",
"Work_NextOperation": "2:30"
}