DownloadMissingPatches
Will download a specified subset of missing patches. With Windows Update Agent, an entry may name the update by kb_id instead of title. Behavior differs by platform:
• Windows (WUA, sig 1103): Delegates to the Windows Update Agent (WUA) API. Patches are downloaded and cached by WUA; OESIS does not manage the cache.
• Linux (apt, sig 200041): Delegates to the apt CLI. Packages are cached at /var/cache/apt/archives, managed by apt and is not controlled by OESIS.
Syntax
Method ID
#define WAAPI_MID_DOWNLOAD_MISSING_PATCHES 1016
JSON Input Structure
{
"input": {
"method": 1016,
"signature": number,
"threads": number,
"retry_internet_services": boolean,
"patches": [
{
"title": string,
"product": string,
"kb_id": string,
"vendor": string
},
...
]
}
}
Input Properties
| Parameter | Type | Description |
|---|---|---|
threads | number | (optional) The number of threads using to download patches, equal to number of patches can be downloaded at the same time. Default value = 4. |
retry_internet_services | boolean | (optional) (Windows Update Agent only) If true, will retry with the internet services when failed with managed servers (if they are configured, such as WSUS, Configuration Server). Default value is true |
patches | array<object> | An array of missing patches to be downloaded. |
patches.title | string | (optional) (Windows Update Agent: may be omitted in an entry that carries kb_id; required for every other product) The title of a missing patch, as the GetMissingPatches method response reports it. |
patches.product | string | (optional) (Windows Update Agent: may be omitted; required for every other product) The product a missing patch will be downloaded for, as the GetMissingPatches method response reports it. |
patches.kb_id | string | (optional) (Windows Update Agent only) The Microsoft KB article number of the update to download: one per entry, digits with an optional KB or kb prefix (e.g. KB5034441 or 5034441). An entry selects updates either by kb_id or by title; when both are given, kb_id decides. In a call where any entry carries kb_id, WAAPI_ERROR_INVALID_INPUT_ARGS is returned and nothing is downloaded when a kb_id is not one KB number, or an entry carries neither kb_id nor title. A kb_id never downloads an update whose category is upgrade (the Windows Update classification Upgrades), or one whose classification cannot be read; that update is reported with state skipped_upgrade. To download an upgrade update, name it by title. |
patches.vendor | string | (optional) The vendor of the product a missing patch will be downloaded for. |
JSON Output Structure
{
"result": {
"method": 1016,
"code": number,
"timing": number,
"timestamp": string,
"patches": [
{
"title": string,
"product": string,
"vendor": string,
"kb_id": string,
"state": string
},
...
],
"patches_source": string
}
}
Output Properties
| Property | Type | Description |
|---|---|---|
result.method | number | The method ID that generated this result. |
result.code | number | The result code. See Result Codes. |
result.timing | number | The measured time for the method call in milliseconds. |
result.timestamp | string | The timestamp in seconds of when the call was made. |
result.patches | array<object> | An array of missing patches that input by user. |
result.patches.title | string | The title of a patch. |
result.patches.product | string | The product of this patch. |
result.patches.vendor | string | (optional) The vendor of the product a missing patch. Only available if user input it in json_in. |
result.patches.kb_id | string | (optional) (Windows Update Agent only) For an update selected by kb_id, the KB number the caller sent, digits only; for an update selected by title, the KB numbers Windows Update Agent lists for it, as GetMissingPatches reports them, left out when there are none. |
result.patches.state | string | The state of a patch after this method completed. It can be: 'not_found' - if patch was not found in result of GetMissingPatches; (Windows Update Agent only) for a kb_id entry, no missing update lists that KB: it is installed, superseded or not offered to this machine, 'not_found_in_cache' - if patch was not found in cache, only available when install_from_cache = true, 'download_failed' - if patch failed in download phase, 'cache_failed' - if patch was downloaded but can not move it to OESIS Framework cache location, 'downloaded' - patch was downloaded and cached successful, 'canceled' - the request was canceled by CancelAsyncRequest before this patch was downloaded, 'skipped_upgrade' - (Windows Update Agent only) a kb_id entry matched this update, but it was not downloaded because its category is upgrade or its classification could not be read; download it by title. |
result.patches_source | string | (optional) (Windows Update Agent only) The source supplying patches: 'Windows Update', 'Microsoft Update', 'WSUS or Configuration Manager', 'Unknown', or the file path to the wsusscn2.cab in case WUA works in offline mode |
Result Codes
| Code | Name | Description |
|---|---|---|
| 0 | WAAPI_OK | The operation completed successfully. |
Other codes may be returned. See the full Result Codes reference for the complete list.
Remarks
Error Handling
The results of this function are determined by the error code returned by the call. If successful, WAAPI_OK or a special success code will be returned. Always check both the function return value and the result.code field in the output JSON.
Knowledge Base
(Windows Update Agent only) In a call where any entry carries kb_id, WAAPI_ERROR_INVALID_INPUT_ARGS is returned and nothing is downloaded when a kb_id is not one KB number, or an entry carries neither kb_id nor title.
(Windows Update Agent only) In a call where any entry carries kb_id, the return code counts entries, not updates: WAAPI_OK when every entry has at least one downloaded update, WAAPI_PARTIAL_SUCCESS when some entries do, and WAAPI_OK_FALSE when none do.
Examples
Examples will be added here demonstrating the usage of this method.
See Also
Last updated: 2026-11-23