Skip to main content

Platform Operations APIs

The system operation and maintenance interface serves platform maintenance integration and is not a backup entrance to ordinary business resources such as models and jobs. They are uniformly located under /api/ops/ and can read service topology and logs. They can also stop services, modify environment configurations, or install module packages. Before calling the write interface, you should first confirm the scope of impact, reserve available fallback points, and arrange a post-installation health check.

See API Conventions for common request headers, response encapsulation, trailing slashes and HTTP status codes. See Authentication and Permissions for roles and organizational scope. If you only maintain the platform through the interface, read Monitor Platform Status and Manage Update Packages first.

Do not regard successful requests as system health

HTTP 200 or code: 0 in the response only indicates that the current interface has completed the step it is responsible for. After the service action is successful, you still need to re-query the running status; the successful release, import or verification of the package does not mean that it has been installed; the acceptance of the installation request does not mean that the installation is completed.

First Confirm the Permissions and Calling Boundaries​

The vast majority of interfaces use platform access tokens:

Authorization: Bearer <access_token>
Accept: application/json

Permissions are divided into three categories:

Interface RangeCallable IdentityThings to Note
Overview, services, hosts, modules, environment configuration, global module packages, operation recordssuper administratorOrganization administrators cannot call these platform-level interfaces to manage an organization.
/workspace-packages/<workspace_type>/...Super administrator, or the organization administrator of the organization that owns the workspaceJudgment based on "owning organization", not based on workspace usage authorization
Compute node heartbeat, restricted automatic publishing entranceCorresponding system components or release pipelinesUses dedicated credentials different from the platform access token and should not be called impersonated by admin scripts

The role and organization claims in the access token are used for permission determination. When the account role has just changed, the token should be refreshed before calling. Do not write superadmin tokens, node credentials, or release credentials to repositories, images, update packages, and pipeline logs.

The following example uses environment variables without real addresses and credentials:

export NEXUSFLOW_BASE_URL="https://nexusflow.example.com"
export NEXUSFLOW_TOKEN="<access_token>"

Paths retain trailing slashes. In addition to file downloads, most successful responses use:

{
"code": 0,
"message": "操作说明",
"data": {}
}

Step 1: Observe the Current Status of the Platform​

Read the overview, service and version first, and then decide whether you need to read logs or perform actions. The query interface itself will not issue start or stop instructions to the service; however, the overview, host and service instance queries will clear the registration of computing nodes that have exceeded the heartbeat time limit according to the platform configuration, so the disappearance of records may also indicate that the node heartbeat has expired.

Operations Overview​

GET /api/ops/summary/

data contains four counts:

FieldMeaning
primary_service_countTotal number of platform master node services
running_primary_service_countNumber of running platform master node services
worker_countNumber of registered computing service instances
running_worker_countNumber of running compute service instances

These counts are suitable for entry-level alarm judgment, but they cannot replace specific service status and health checks.

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
-H "Accept: application/json" \
"${NEXUSFLOW_BASE_URL%/}/api/ops/summary/"

Platform Master Node Service​

GET /api/ops/primary-services/

The interface returns a direct array. Each item comes from the current platform configuration, and the fields may change with different service definitions; runtime_status is the current running state, and the service_name required for the service action path should be read from this list. Do not guess or hard-code the internal service name on the client.

Compute Nodes and Service Instances​

GET /api/ops/hosts/
GET /api/ops/service-instances/

The host list returns a direct array. Common fields are as follows:

FieldMeaning
idHost integer ID, environment configuration path uses this value
name / hostnamedisplay name and node hostname
status / enabledNode status and whether it is enabled
last_seen_atThe time when the last heartbeat was received
capabilitiesList of capabilities declared by the node agent
base_urlNode proxy address; it belongs to platform topology information and should not be displayed to ordinary users.

The service instance list only returns the computing services currently managed by the platform and is encapsulated using paging. Common fields include id, instance_key, display_name, host_name, host_status, runtime_status, last_sync_at, and last_error. Log and action paths use the integer instance id .

Supported query parameters are:

ParametersAvailable Values or Meanings
hostRefine filter by host name
runtime_statusFilter precisely by running status
orderingdisplay_name, host_name, runtime_status or host_name,display_name
page / page_sizePage number and quantity per page; page_size is up to 100

For example:

GET /api/ops/service-instances/?runtime_status=running&ordering=host_name,display_name&page=1&page_size=20

Modules and Deployed Versions​

GET /api/ops/modules/

The module list is encapsulated using pagination. Each item contains id, name, display_name, latest_version, deployed_version and artifact_count:

  • latest_version is the latest version created among the currently registered products;
  • deployed_version is the version corresponding to the latest successful deployment record;
  • The difference between the two is not necessarily a malfunction, it may also mean that the new version has not been installed yet.

ordering only supports display_name, name and -created_at.

Pagination Does Not Work for All Lists​

Service instance, module, and operation records use the following paging structure:

{
"code": 0,
"message": "获取成功",
"data": {
"results": [],
"pagination": {
"current_page": 1,
"page_size": 20,
"total_pages": 1,
"total_count": 0,
"has_next": false,
"has_previous": false
}
}
}

The valid range of page_size is 1~100; invalid values will return to the default value 10. The platform main node service, host, module package recipe and version list are directly returned as arrays in data. Do not parse them uniformly according to results.

Step 2: Read the Log to Locate the Problem​

Service Log​

GET /api/ops/primary-services/<service_name>/logs/?tail=200
GET /api/ops/service-instances/<instance_id>/logs/?tail=200

tail indicates the number of lines at the end of reading. The default value is 200 and an integer must be passed. The interface currently does not uniformly limit the number of log lines for the caller. The integration program should set a reasonable upper limit by itself to avoid reading too much content at one time.

data of the platform master node service log includes service_name, tail and content. Compute node logs are returned by the node agent, and the caller should at least be compatible with the log body and node-side additional information, rather than assuming that the two responses are completely isomorphic.

export SERVICE_NAME="<service_name>"

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
"${NEXUSFLOW_BASE_URL%/}/api/ops/primary-services/${SERVICE_NAME}/logs/?tail=200"

Unknown services return 404; 502 is usually returned when logs cannot be obtained from the running environment or computing node. Logs may contain account names, host names, topologies, request parameters or configuration fragments, and should be desensitized before saving and forwarding.

Module Package Installation Log​

GET /api/ops/packages/recipes/<recipe_name>/versions/<version>/install-log/
GET /api/ops/workspace-packages/<workspace_type>/packages/recipes/<recipe_name>/versions/<version>/install-log/

The interface returns the latest deployment record of the specified version:

  • deployment_id: Deployment record integer ID;
  • status: pending, running, success, failed or rolled_back;
  • created_at: record creation time;
  • content: Currently available installation logs.

404 may be returned when there is no such version, no deployment record, or no access to the workspace. An empty text in the log does not mean the job is successful. You should check both status and the deployment status in the version list.

Step 3: Perform Controlled Actions​

Start, Stop or Restart Services​

Platform master node service and compute node service instances use the same action value:

POST /api/ops/primary-services/<service_name>/actions/
POST /api/ops/service-instances/<instance_id>/actions/
Content-Type: application/json

{
"action": "restart"
}

action only supports start, stop and restart. The current implementation will perform control actions within the HTTP request and update the corresponding operation record from running to success or failed, which is not a background queue job.

Check the status before and after calling:

  1. Obtain the real identity, current status and node from the service list;
  2. Identify affected users, running jobs and dependent services;
  3. Only submit one explicit action at a time and record the caller's own request time;
  4. After the response is successful, re-query the service status and perform a business health check;
  5. When the request times out or returns 502, check the service status and operation records first, and do not submit again immediately.

A successful service action response indicates that the control command has returned successfully, and there is no guarantee that all dependent services have been restored and available.

View and Modify Environment Configuration​

GET /api/ops/environments/primary/
PUT /api/ops/environments/primary/

GET /api/ops/environments/workers/<host_id>/
PUT /api/ops/environments/workers/<host_id>/

GET returns target information, revision and variables. Each variable describes the current value, whether it has been set, whether to use the default value, whether it is sensitive, whether it is editable, why it is read-only, and the affected services. The value and default_value of sensitive variables return null, which does not mean that the value is empty; the client shall not automatically write back this null.

PUT must bring the revision just read, and only submit confirmed changes:

{
"revision": "<current_revision>",
"changes": [
{
"key": "<editable_key>",
"operation": "set",
"value": "<new_value>"
}
]
}

operation only supports set and unset; unset only applies to variables with default values. Unknown variables and read-only variables cannot be modified through this interface. 409 is returned when revision has changed. It should be re-read and merged manually. The new configuration cannot be overwritten with old requests.

The environment application verifies the configuration, updates the environment, and rebuilds affected services. When the platform master node application fails, it will try to restore the original configuration, and give rollback_performed, rollback_succeeded and other information in the returned data; whether the computing node supports environment management is determined by its capabilities. If it does not support it, it will return 409. Both types of applications may wait for service reconstruction and inspection. The client's timeout does not mean that the platform must not be executed.

Required checks before modifying environment configuration
  • Save the current revision, non-sensitive configuration snapshot and independent rollback plan;
  • Only modify the variables of editable: true and confirm affected_services item by item;
  • When coordinating shared credentials, modify all relying parties at the same time, not just one side;
  • After returning, check changed_keys, restarted_services, rollback results and service health;
  • When the rollback fails, subsequent write operations are stopped and manual recovery is performed.

The Computing Node Heartbeat Is a Proxy Protocol​

POST /api/ops/agents/heartbeat/

This interface reports hosts, capabilities, and service instances by the compute node agent, authenticates with dedicated node credentials, and does not accept super administrator access tokens as an alternative. host_id and upserted_instances in the successful response indicate the number of host records and instances updated this time; old instances that are not in this heartbeat will be removed from the host registration.

Administrator integrations typically only read /hosts/ and /service-instances/ and should not manually construct heartbeats, nor should they read, log, or forward node credentials.

Step 4: Manage Module Packages and Operation Records​

Understand Recipes, Versions and Deployment Records First​

Module package management is divided into three levels:

  1. Recipe describes the name of the package, its modules, dependencies, capabilities, categories and applicable workspace;
  2. Version is a built or imported artifact with creation time, SHA-256 checksum, and last deployed status;
  3. Deployment Record describes the installation process of a certain version and is not equivalent to a general operation record.

The global module package interface is only allowed to be called by super administrators:

Methods and PathsFunctionReturn Form
GET /api/ops/packages/recipes/List recipes with latest versions, deployed versions, dependencies and deregistration conditionsdata direct array
GET /api/ops/packages/recipes/<recipe_name>/versions/List product version, check value, whether it has been deployed and recent deployment informationdata direct array
POST /api/ops/packages/export/Export the specified version as an offline zip packageFile download
POST /api/ops/packages/import/Import the offline zip package and register the version in itGeneric JSON
POST /api/ops/packages/recipes/<recipe_name>/install/Submit an asynchronous installation jobGeneric JSON with deployment record ID
POST /api/ops/packages/recipes/<recipe_name>/verify/Synchronously execute the verification rules of this versionGeneric JSON
GET .../versions/<version>/install-log/View the latest installation status and logsGeneric JSON
DELETE /api/ops/packages/recipes/<recipe_name>/Cancel the registration of a deletable recipeGeneric JSON; not uninstall

can_unregister and unregister_blockers in the recipe list are used to determine whether registration can be cancelled. last_deployment_id, last_deployment_status, last_deployed_at, and has_install_log in the version entries are used to track installations.

Workspace Package​

The workspace package uses qualified paths:

Methods and PathsFunction
GET /api/ops/workspace-packages/<workspace_type>/Get the space package ID and latest product version
POST /api/ops/workspace-packages/<workspace_type>/publish/Synchronously build the space resource package according to version in the request
GET /api/ops/workspace-packages/<workspace_type>/packages/List the resource packages and kernel class module packages that can be managed by this space
GET .../packages/recipes/<recipe_name>/versions/List the versions of the specified package in this space
POST .../packages/export/ / POST .../packages/import/Export or import offline packages belonging to this space
POST .../packages/recipes/<recipe_name>/install/Submit the asynchronous installation job of the package in this space
POST .../packages/recipes/<recipe_name>/verify/Synchronously verify the package version in this space
GET .../versions/<version>/install-log/View the recent installation log of the package version in this space

workspace_type is the stable type identifier of workspace. Organization administrators of the space owning organization can only access the space's restricted path, and cannot therefore access the global package interface, nor can they operate spaces that are shared only with their own organization but are not owned by that organization.

Space package information and publishing results may contain path fields for use by platform diagnostics. The integration program should use workspace_type, recipe_name, version, artifact_id and checksum_sha256 as the business basis, and do not save or display the server file path.

Publish, Import and Export Are Not Equal to Installation​

Publish the workspace package using:

POST /api/ops/workspace-packages/<workspace_type>/publish/
Content-Type: application/json

{
"version": "1.2.3"
}

The current request will build the artifact and write the operation record synchronously. Success only proves that the version has been built and registered, and the target environment still needs to be installed and verified later.

The export request format is:

{
"items": [
{
"recipe_name": "<recipe_name>",
"version": "<version>"
}
],
"include_dependencies": false
}

The export interface directly returns the zip file and does not return message/code/data. The response header X-Package-Bundle-Items indicates the number of version items actually written into the package. include_dependencies: true will add the currently resolvable dependency versions to the export package.

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"items":[{"recipe_name":"<recipe_name>","version":"<version>"}],"include_dependencies":false}' \
-o package-bundle.zip \
"${NEXUSFLOW_BASE_URL%/}/api/ops/packages/export/"

The import uses multipart/form-data, and the file field is fixed to file:

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
-F "file=@package-bundle.zip;type=application/zip" \
"${NEXUSFLOW_BASE_URL%/}/api/ops/packages/import/"

The import is completed within the current request. archive_name and imported_items in the successful response only indicate that the formula and product version have been registered and will not be automatically installed. The space-qualified import interface also verifies that the package belongs to the target workspace.

Installation Is an Asynchronous Job​

POST /api/ops/packages/recipes/<recipe_name>/install/
Content-Type: application/json

{
"version": "<version>"
}

A successful response indicates that the background installation job has been submitted. The fields available for tracking in data include:

FieldMeaning
recipe_name / versionTarget recipe and version
deployment_idThe integer ID of this or existing running deployment record
statusThe deployment status at the time of submission, usually running
asyncCurrently true
messageHuman readable hint, not used for program branches

When the same product has already been deployed with running, the interface will return the existing deployment record instead of creating another one. There is currently no common endpoint for reading deployment details by deployment_id; this should be tracked through the last_deployment_id, last_deployment_status and installation log interfaces of the version list. Only when the status changes to success, and the installation log, version status, and service health are all in line with expectations, can the installation be considered complete.

export RECIPE_NAME="<recipe_name>"
export PACKAGE_VERSION="<version>"

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"version\":\"${PACKAGE_VERSION}\"}" \
"${NEXUSFLOW_BASE_URL%/}/api/ops/packages/recipes/${RECIPE_NAME}/install/"

curl -sS \
-H "Authorization: Bearer ${NEXUSFLOW_TOKEN}" \
"${NEXUSFLOW_BASE_URL%/}/api/ops/packages/recipes/${RECIPE_NAME}/versions/${PACKAGE_VERSION}/install-log/"

When the installation log status stays at running for a long time, do not install again directly. First check the deployment record time, whether the log continues to grow, the target service status and the deployed version, and then the maintenance personnel determine whether the background job is still alive.

Checksum Deregistration​

The synchronization verification interface uses the same version request body as the installation:

POST /api/ops/packages/recipes/<recipe_name>/verify/

It executes the validation rules defined by the recipe and writes common operation records, but does not install the version. Successful verification only proves that the verification rules have passed, but does not mean that the service has been switched to this version.

DELETE /api/ops/packages/recipes/<recipe_name>/

The current route does not have an interface for "unloading deployed running content". The DELETE here is only used to cancel dynamic recipe registration and delete its registered product version; a successful response will indicate the number of deleted versions and the number of retained deployment records, and the installed running content will be retained. Returns 409 when dependencies, built-in recipes, or other blocking conditions exist. Therefore, this endpoint cannot be used in place of the uninstall or rollback process.

Restricted Automatic Publishing Entry​

POST /api/ops/plugin-bundles/publish/

This multipart interface is only used by designated release pipelines to build unified plug-in packages, using dedicated release credentials, and does not accept administrator access tokens as an alternative. The request contains SemVer-compliant version and a compressed source file named file, with a current upload limit of 256 MB. Business integration and daily administrator scripts should not call this portal, nor should their private credentials be saved.

Operation Records and Deployment Records Are Two Sets of Records​

GET /api/ops/operations/?page=1&page_size=20&ordering=-created_at

Operation records are encapsulated using paging, and ordering only supports created_at and -created_at. Each public field is:

FieldMeaning
idOperation record integer ID
target_type / target_nameOperation target category and identification
actionActions such as service control, environment application, build, import, export, or verify
statuspending, running, success or failed
operator_usernameOperator username
detailCurrent operating instructions or error summary
created_atcreation time

General operation records will be written for service actions, environment applications, package construction, import, export, verification and deregistration. Asynchronous installation mainly writes deployment records, and there will not be a common "installation operation" with the same meaning; the verification performed before the installation is completed may also appear in the operation record.

ProcessCurrent Execution ModeMain Tracking Entrance
Service start, stop or restartSynchronous execution within the requestService list + operation record
Environment configuration applicationExecuted synchronously within the request, possibly waiting for reconstruction and inspectionEnvironment configuration + service list + operation record
Space package publishing, package verification, import, export, and unregistrationSynchronous execution within the requestRecipe/version list + operation record
Package installationBackground asynchronous executionVersion list + installation log

Timeouts, Failures and Duplicate Requests​

The operation and maintenance writing interface does not have idempotent keys for callers to use uniformly. When the network times out, the gateway times out or the connection is interrupted, it cannot be judged that the server is not executing, and do not automatically retry POST, PUT or DELETE.

Confirm the actual status in the following order:

  1. Log the request path, target ID, request start time, and HTTP status, but do not log tokens and sensitive configuration values;
  2. Query /api/ops/operations/ and check synchronization operations according to operation time, target and action;
  3. Change the installation request to check the corresponding version list and install-log, do not just check the general operation record;
  4. Service action and environment application re-read service, host or environment revision;
  5. Re-read recipe and version lists after import, publish or delete timeout;
  6. Only after it is confirmed that there are no records that have been executed or in progress, the maintenance personnel will decide whether to resubmit.

Common responses should be handled like this:

PhenomenonCheck FirstRecommended Treatment
401Is the token missing, expired, or malformed?Reauthenticate without changing to node or publishing credentials
403Whether he is a super administrator; whether the space-limited interface manages the owning organizationRefresh the token and check the permissions. Do not change the global interface to bypass
404Trailing slash, target ID, version and access scopeRetrieve the identifier from the list interface
409Environment revision, recipe unregistration blocking items, node capabilitiesRead the latest state and handle conflicts, don't force overwrites
502 / 504Compute node, service status, operation or deployment recordsFirst confirm whether the action has occurred, and then decide on the recovery steps
Install long-term runningLog update time, target version, service statusKeep the site and check the background installation process. Failure cannot be determined based on the duration alone.

Pre-Launch Checklist​

  • Use dedicated, auditable maintenance identities and keep platform tokens, node credentials and publishing credentials separately;
  • Read services, instances, recipes and version identifiers from list responses, and do not hard-code the deployment topology in scripts;
  • Manual confirmation of service actions, environment configuration and package management settings, and write requests will not be automatically retried;
  • Check the HTTP status, Content-Type and Content-Disposition before downloading the file, and do not save the JSON error text as zip;
  • After importing, first check imported_items and SHA-256, and then select the installation version;
  • After the installation is completed, review the version status, installation logs, service health and a real business path;
  • Before sharing logs and operation records, clean host names, topologies, configuration values, and user information.