import-source
Use the interface t import sources.
Request Mode
POST http://ip/mwapi/import-source
Parameter | Description |
---|---|
sourceType | The source type 1: picture 2: video 6: music 13: PDF 14: web page |
fileName | The filename, not required when sourceType is 14 |
md5 | The MD5 value of the file, not required when the sourceType is 14 |
url | The URL of web page, required only when the sourceType is 14 |
ps: The file has been uploaded to the server through “/mwapi/upload-source-file”.
Response Body
JSON structure is as follows:
{
"info":{
"duration":0,
"filePath":"2039/2039.png",
"height":1080,
"id":2039,
"name":"IMG_3162",
"rotation":0,
"thumbnailPath":"2039/2039.thumb.jpeg",
"type":1,
"width":1440
},
"message":"success",
"result":0
}
1. Response Status
"status": 0
Name | Description |
---|---|
status | 0 indicates that the request was accepted successfully. Refer to API Status Codes to find specific description for other values. |
info | The source entity |
2. Import PDF
Get the import process and result by monitoring DEVICE_STATUS_CHANGED_PDF_IMPORTING in the websocket.
{
"event":4001,
"info":{
"pdfImportResult":{
"info":{
"currentPage":1,
"totalCount":116
},
"status":5
},
"statusType":2019
}
}
or
{
"event":4001,
"info":{
"pdfImportResult":{
"info":{
"duration":0,
"filePath":"2047/2047.pdf",
"height":1080,
"id":2047,
"md5":"9eb78b0db5530020778ced7840a1d2f2",
"name":"USB Fusion User Manual",
"secondaryType":0,
"thumbnailPath":"2047/2047.thumb.jpeg",
"totalPageNumber":116,
"type":13,
"width":1920
},
"status":0
},
"statusType":2019
}
}
Name | Description |
---|---|
status | The import status 0: Successfully imported 1: System error 3: Decoding error 5: Importing 6: System busy |
info | Import progress or the imported source entity |
Name | Description |
---|---|
totalCount | The total number of PDF pages |
currentPage | The number of currently imported pages, 1, 2, 3... |
3. Import Web Page
Get the import result by monitoring DEVICE_STATUS_CHANGED_IMPORT_WEB_BROWSER in the websocket.
{
"event":4001,
"info":{
"httpStatus":-105,
"result":0,
"statusType":2023,
"url":"https://www.baidu.com"
}
}
or
{
"event":4001,
"info":{
"httpStatus":200,
"result":1,
"sourceInfo":{
"duration":0,
"filePath":"",
"height":1080,
"homeUrl":"youku.com",
"id":2049,
"md5":"youku.com",
"name":"youku.com",
"secondaryType":0,
"thumbnailPath":"2049/2049.thumb.jpeg",
"totalPageNumber":0,
"type":14,
"url":"youku.com",
"width":1920
},
"statusType":2023,
"url":"youku.com"
}
}
Name | Description |
---|---|
result | 0: failed, 1: successful |
httpStatus | 200: Access successfully -105: Domain name resolution error -1: Failed to connect the web page due to invalid time 300: URL error 302: URL error 404: Page not found |
sourceInfo | The source entity |