Description
You can upload a local software package to the OCP server. You can filter the software package list by specifying the software package name, type, version, operating system, and architecture. You can also sort the list by upload time.
API call instructions
Interface constraints
The caller must have the PACKAGE_MANAGER privilege.
Request path
POST /api/v2/software-packages
Request type
multipart/form-data
Request parameters
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| file | Binary | Yes | File information | The file to be uploaded to the server. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The software package metadata. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server finishes processing the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application server that responds to the request. |
SoftwarePackageMeta data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the software package. |
| name | String | The name of the software package. |
| fileName | String | The full name of the software package file. |
| extension | String | The 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 URL for downloading the software package. |
| type | String | The type of the software package. Valid values: |
| 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 architecture of the software package. |
| deletable | Boolean | Indicates whether the software package can be deleted. |
Examples
Request example
POST /api/v2/software-packages?file=t-oceanbase-ocp-agent-3.1.2-20210812221.rpm
Return example
{
"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": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-24T21:40:09.952+08:00",
"traceId": "baffb6be55b0473a"
}
