Check if resource file exists

1. API Description

This API is used to check whether the resource file already exists.

Request mode:

  • V2.6.0 and above: POST [ip]/mwapi/V2.0/source/check-source-exist
  • V2.5.0 and below: POST [ip]/mwapi/check-source-exist
Administrator Rights Logged-in
No Yes

2. Input Parameters

Name Required Type Description
md5 No String MD5 value of the file, not required when sourceType is 14
url No String URL, only effective when sourceType is 14
sourceType Yes Int Type of resource
1: Picture; 2: Video; 6: Music; 10: GFX; 11: Scene Background Image; 13: PDF; 14: Web page

3. Output Parameters

Name Type Description
result Int Status code
message String Status description
info InfoData Resource existence status information
InfoData
Name Type Description
find Int Whether the resource exists
0: No; 1: Yes
source SourceData Resource entity information
SourceData
Name Type Description
duration Int Duration of the resource. Only valid for videos and music.
filePath String Relative path of the resource file, which can be accessed via http://[Device IP]/file/relative_path.
height Int Height of the resource
homeUrl String Home page URL. Only valid for web pages
id Int Resource ID, the unique identifier for the resource on the device
md5 String MD5 value of the file
name String Resource name
rotation Int Rotation angle, counterclockwise direction, ranging from 0 to 360
thumbHeight Int Resource thumbnail height
thumbWidth Int Resource thumbnail width
thumbnailPath String Relative path of the resource thumbnail, which can be accessed via http://[Device IP]/file/relative_path
type Int Resource type
0: Preset resource (capture + picture + video)
1: Picture
2: Video
6: Music
7: Note background image
10: GFX image
11: Scene background image
12: Scene background color
13: PDF file
14: Web page
url String URL of the web page. Only valid for web pages
width Int Width of the resource

4. Example

Checking if the picture file already exists.

Input Example
{
    "md5": "asdfghjklkjhgfdsdfghjk",
    "sourceType": 1
}
Output Example
{
    "info": {
        "find": 1,
        "source": {
            "duration": 0,
            "filePath": "2009/2009.JPG",
            "height": 1080,
            "id": 2009,
            "md5": "f7e7f0cd578a44c77aed69e7c147d676",
            "name": "IMG_3010",
            "rotation": 0,
            "secondaryType": 0,
            "thumbHeight": 144,
            "thumbWidth": 256,
            "thumbnailPath": "2009/2009.thumb.jpeg",
            "type": 1,
            "width": 1920,
            "url": ""
        }
    },
    "message": "success",
    "result": 0
}

5. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Status Definition Description
7 MW_STATUS_INVALID_ARG Missing required parameters
29 MW_STATUS_NO_SPACE Insufficient disk space

results matching ""

    No results matching ""