Upload a software package

2023-08-15 11:20:59  Updated

Description

You can call this operation to upload a local software package to the OCP server. You can query software packages by keyword of their names, type, version, operating system, or architecture, or sort them by upload time.

Call description

Prerequisite

You have the PACKAGE_MANAGER permissions.

Request path

POST /api/v2/software-packages

Request type

multipart/form-data

Request parameters

Parameter Type Required Example value Description
file Binary Yes File information The file to be uploaded to the server.

Response parameters

Parameter Type Description
data Object The SoftwarePackageMeta object.
successful Boolean Indicates whether the request was successful.
timestamp Datetime The timestamp when the server completed the request.
duration Integer The time taken by the server to process the request, in milliseconds.
status Integer An HTTP status code.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the application server that responded to the request.

Data structure of SoftwarePackageMeta

Parameter Type Description
id Integer The ID of the software package.
name String The name of the software package.
fileName String The full file name of the software package.
extension String The file name extension of the software package.
size Integer The size of the software package, in bytes.
sha1 String The SHA1 value of the software package.
downloadUrl String The download URL of the software package.
type String The type of the software package. * OB_SERVER_INSTALL_PACKAGE * OCP_AGENT_INSTALL_PACKAGE * OBPROXY_INSTALL_PACKAGE * OB_BACKUP_AGENT_INSTALL_PACKAGE
version String The version of the software package.
buildNumber String The build number of the software package.
operatingSystem String The operating system supported by the software package.
architecture String The system architecture of the software package.

Examples

Sample request

POST /api/v2/software-packages?file=t-oceanbase-ocp-agent-3.1.2-20210812221.rpm

Sample response

{
  "data": {
    "architecture": "x86_64",
    "buildNumber": "20210812221645",
    "downloadUrl": "http://localhost:8080/api/v2/files/sys-package/t-oceanbase-ocp-agent-3.1.2-20210812221645.alios7.x86_64.rpm",
    "extension": "rpm",
    "fileName": "t-oceanbase-ocp-agent-3.1.2-20210812221645.alios7.x86_64.rpm",
    "id": 26,
    "name": "t-oceanbase-ocp-agent",
    "operatingSystem": "alios7",
    "sha1": "4e5ac896c41c7aa9eda09f4a9b72cbe6f7fc78bc",
    "size": 38400132,
    "type": "OCP_AGENT_INSTALL_PACKAGE",
    "version": "3.1.2"
  },
  "duration": 6765,
  "server": "192.168.0.1",
  "status": 200,
  "successful": true,
  "timestamp": "2021-08-24T21:40:09.952+08:00",
  "traceId": "baffb6be55b0473a"
}

Contact Us