API
Create Document
POST/universer-api/snapshot/{type}/unit/-/create
Headers
content-type: application/json
Body Parameters
Parameter | Type | Example | Description |
---|---|---|---|
type * | enum(int) | - | 1 (docs), 2 (sheets) path and request body parameters |
name * | string | - | Document name |
creator * | string | - | Creator ID |
curl http://localhost:8000/universer-api/snapshot/{type}/unit/-/create \
-X POST \
-H 'Content-Type: application/json' \
--data-raw '{"type":2,"name":"New Sheet By Univer","creator":"userID"}'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
unitID | string | - | Document ID |
{
"error": {
"code": 1,
"message": "success"
},
"unitID": "ETVf-B4lQqOSE_p09mcp9Q"
}
Get Document List
GET/universer-api/snapshot/{type}/units
Headers
Query Parameters
Parameter | Type | Example | Description |
---|---|---|---|
type * | enum(int) | - | 1 (doc), 2 (sheet) path and request body parameters |
nextCursor | string | - | Next page cursor for pagination |
curl -X GET 'http://localhost:8000/universer-api/snapshot/1/units?nextCursor=100'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
units | array[object] | - | List of documents |
unitID | string | - | Document ID |
name | string | - | Document name |
type | enum(int) | - | 1(doc),2(sheet) |
nextCursor | string | - | Next page cursor for pagination, empty when it is the last page |
{
"error": {
"code": 1,
"message": ""
},
"units": [
{
"unitID": "1",
"name": "a",
"type": 1
}
],
"nextCursor": "200"
}
Delete Document
DELETE/universer-api/snapshot/-/units
Headers
content-type: application/json
Query Parameters
Parameter | Type | Example | Description |
---|---|---|---|
unitIds * | array[string] | - | Array of document IDs |
curl -X DELETE 'http://localhost:8000/universer-api/snapshot/-/units?unitIds=1&unitIds=2'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
{
"error": {
"code": 1,
"message": ""
}
}
Upload File
POST/universer-api/stream/file/upload
Headers
content-type: multipart/form-data
Body Parameters
Parameter | Type | Example | Description |
---|---|---|---|
size * | int | - | File size (byte), query parameter; the parameter must equal the actual file size, otherwise it will return an error |
file * | Form.file | - | HTML form file upload |
curl 'http://localhost:8000/universer-api/stream/file/upload?size=125466' \
--header 'cookie: _univer=XXXXXX' \
--form 'file=@"demo.xlsx"'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
FileId | string | - | File ID, used for subsequent requests such as import and export |
{
"FileId": "xxxx"
}
Import
POST/universer-api/exchange/{type}/import
Headers
content-type: application/json
Body Parameters
Parameter | Type | Example | Description |
---|---|---|---|
type * | enum(int) | - | 1 (doc), 2 (sheet) |
outputType * | enum(int) | - | 1 (unit), 2 (json) |
fileID * | string | - | The ID of the uploaded file |
minSheetRowCount * | int | - | Minimum row count, the import will check if the sheet row count meets the requirement |
minSheetColumnCount * | int | - | Minimum column count, the import will check if the sheet column count meets the requirement |
curl -X POST 'http://localhost:8000/universer-api/exchange/2/import' \
-H 'Content-Type: application/json' \
--data-raw '{"fileID":"123","outputType":1,"minSheetRowCount":1000,"minSheetColumnCount":20}'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
taskID | string | - | Conversion task ID, import and export are asynchronous, use this ID to poll the interface for conversion results |
{
"error": {
"code": 1,
"message": ""
},
"taskID": "456"
}
Export
POST/universer-api/exchange/{type}/export
Headers
content-type: application/json
Body Parameters
Parameter | Type | Example | Description |
---|---|---|---|
type * | enum(int) | - | 1 (doc), 2 (sheet) |
unitID * | string | - | Document ID |
sscSwitch | boolean | - | Whether to enable SSC (Server Side Calculation), set to true to trigger server-side formula calculation, default is false |
curl -X POST 'http://localhost:8000/universer-api/exchange/2/export' \
-H 'Content-Type: application/json' \
--data-raw '{"unitID":"xxxx","type":2}'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
taskID | string | - | Conversion task ID, import and export are asynchronous, use this ID to poll the interface for conversion results |
{
"error": {
"code": 1,
"message": ""
},
"taskID": "456"
}
Get Conversion Result
GET/universer-api/exchange/task/{taskID}
Headers
Path Parameters
Parameter | Type | Example | Description |
---|---|---|---|
taskID * | string | - | Conversion task ID |
curl -X GET 'http://localhost:8000/universer-api/exchange/task/123'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
status | enum(string) | - | "pending", "done", "failed" |
export | object | - | - |
fileID | string | - | The file ID of the export conversion result, used for subsequent requests to get file content |
import | object | - | - |
unitID | string | - | The unit ID after import conversion, used to open the online spreadsheet |
jsonID | string | - | The file ID of the import conversion result in JSON format, used for subsequent requests to get file content |
{
"error": {
"code": 1,
"message": ""
},
"status": "done",
"export": {
"fileID": "456"
},
"import": {
"unitID": "789",
"jsonID": "012"
}
}
Get File
GET/universer-api/file/{fileID}/sign-url
Headers
Path Parameters
Parameter | Type | Example | Description |
---|---|---|---|
fileID * | string | - | The file ID of the conversion task result |
curl -X GET 'http://localhost:8000/universer-api/file/1234/sign-url'
Response
application/json
Parameter | Type | Example | Description |
---|---|---|---|
error | object | - | - |
code | enum(int) | - | 1 (success) |
message | string | - | The information of fail situation |
url | string | - | The download URL of the file |
{
"error": {
"code": 1,
"message": ""
},
"url": "https://example.com/path/to/file.xlsx"
}