Information Submission Interface Specification
Update:
1. Parameter specification
- Request URL:
Get it from the Console - Service Configuration
- Interface description:
Submit the video information to the interface. After the information is submitted, screenshots of the video will be detected, and the results need to be obtained by calling the Result Obtaining Interface.
- Supported Formats:
Video package formats supported by the detection interface: flv、mkv 、mp4 、rmvb 、avi 、wmv、3gp、ts、mov etc.
- Size limit:
Size limit of the video: <1G.
- HTTP Request Header:
Header
Value
Description
Content-Type
application/json;charset=UTF-8
Request body type
Accept
application/json;charset=UTF-8
Accepted return type
X-AppId
The only identifier of the project or application.
X-TimeStamp
The UTC timestamp of the request. Timestamps need to be formatted according to W3C standards, for example: 2010-01-31T23:59:59Z. (http://www.w3.org/TR/xmlschema-2/#dateTime)。
Authorization
Signature value
-
Request method:POST
-
Request body JSON object:
Parameter
Required
Type
Description|
type
Required
Number
1: Video URL; 2: Video BASE64 value
video
Required
Srting
Video content, if type=1, then the value is the Video URL, if type=2, then the value is Video BASE64 value. When type is 2, then the video must be less than 10m.
videoName
Optional
String
The name of the video file. When type=2 and the video is BASE64, this parameter is essential and can indicate the video format
lang
Optional
String
Default zh-CN;
frequency
Optional
Number
Default frame extraction setting, there will be one frame captured and detected every 5 seconds, the settable range is 1~60 seconds
userId
Optional
Srting
Unique end user ID. The user ID should be no more than 32 characters.
userIP
Optional
Srting
User IP address
did
Optional
Srting
User device ID
dtype
Optional
Srting
User device type: 1:iPhone 2:User device type: android 3: ipad 4:wphone 5: pc 6:web 7:wap
callbackRegion
Optional
String
callback region:default use cn server to do callback,supports : cn,us,eu
callbackUrl
Optional
String
callback url:http
callbackSecretKey
Optional
String
callback secret key, customizable. but is necessary be consistent in your callback signature
-
Example of request body:
JSON Response
{
"type":2,
"video":"http://xxx.xxx.com/xxxx",
"userId": "testUser",
"did": "868034031518269",
"dtype": "1"
}
-
Request signature:
When the user requests the Video Submit API, the request can be signed with the appId and secretKey (obtained from the Console - Service Configuration). When the API receives the request with the signature information, it will verify the signature using the same algorithm, and if the signature is found to be inconsistent, the API will return 401 error to the user.
If the API validates the signature to be consistent and the user corresponding to the appId has permission to operate the requested resource, then the request succeeds, otherwise the API returns 401 error.
- Send signatures by HTTP Request Headers
Method: Add a header named Authorization in the request, whose value is the signature value. For example:
Authorization: *****
- Signature calculation method
- Canonicalized Query String
Convert the request body JSON string to a hexadecimal string (not Base64) by doing sha256 encoding with UTF-8 character encoding.
CanonicalizedQueryString = hex(sha256(jsonBody))
2.Constructs the signed string StringToSign ("\n" stands for ASCII newline character):
StringToSign = HTTPMethod + "\n" +
HostHeaderInLowercase + "\n" +
HTTPRequestURI + "\n" +
CanonicalizedQueryString <Get from the previous step> + "\n" +
"X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
"X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER
HTTPRequestURI is the absolute path to the request URI, not containing the CanonicalizedQueryString. If the HTTPRequestURI is empty, a forward slash (/) will be retained.
The hash-based message authentication code (HMAC) is created using the HMAC-SHA256 protocol and then the signature is calculated.
-
StringToSign serves as the signature string, secretKey serves as the secret key and SHA256 serves as the hash algorithm
For more information about HMAC, see: https://tools.ietf.org/html/rfc2104。
-
Converting the results of the previous step to a BASE64 string
-
Put the BASE64 string into the Authorization of HTTP request Header
- Example of signature
Below is an example of appId & secretKey & video
appId=***
secrectKey=****
video_url="http://xxx.xxx.com/xxxx"
Below is an example of request body.
{
"type": 1,
"video":"http://xxx.xxx.com/xxxx",
"userId": "12345678"
}
Generate CanonicalizedQueryString
b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
Generate StringToSign
POST
vsafe.ilivedata.com
/api/v1/video/check/submit
b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
X-AppId:***
X-TimeStamp:2020-07-31T07:59:03Z
Signatures from HMAC calculations
*****
1. Parameter specification
- Request URL:
Get it from the Console - Service Configuration
- Interface description:
Submit the video information to the interface. After the information is submitted, screenshots of the video will be detected, and the results need to be obtained by calling the Result Obtaining Interface.
- Supported Formats:
Video package formats supported by the detection interface: flv、mkv 、mp4 、rmvb 、avi 、wmv、3gp、ts、mov etc.
- Size limit:
Size limit of the video: <1G.
- HTTP Request Header:
Header | Value | Description |
---|---|---|
Content-Type | application/json;charset=UTF-8 | Request body type |
Accept | application/json;charset=UTF-8 | Accepted return type |
X-AppId | The only identifier of the project or application. | |
X-TimeStamp | The UTC timestamp of the request. Timestamps need to be formatted according to W3C standards, for example: 2010-01-31T23:59:59Z. (http://www.w3.org/TR/xmlschema-2/#dateTime)。 | |
Authorization | Signature value |
-
Request method:POST
-
Request body JSON object:
Parameter | Required | Type | Description| |
---|---|---|---|
type | Required | Number | 1: Video URL; 2: Video BASE64 value |
video | Required | Srting | Video content, if type=1, then the value is the Video URL, if type=2, then the value is Video BASE64 value. When type is 2, then the video must be less than 10m. |
videoName | Optional | String | The name of the video file. When type=2 and the video is BASE64, this parameter is essential and can indicate the video format |
lang | Optional | String | Default zh-CN; |
frequency | Optional | Number | Default frame extraction setting, there will be one frame captured and detected every 5 seconds, the settable range is 1~60 seconds |
userId | Optional | Srting | Unique end user ID. The user ID should be no more than 32 characters. |
userIP | Optional | Srting | User IP address |
did | Optional | Srting | User device ID |
dtype | Optional | Srting | User device type: 1:iPhone 2:User device type: android 3: ipad 4:wphone 5: pc 6:web 7:wap |
callbackRegion | Optional | String | callback region:default use cn server to do callback,supports : cn,us,eu |
callbackUrl | Optional | String | callback url:http |
callbackSecretKey | Optional | String | callback secret key, customizable. but is necessary be consistent in your callback signature |
-
Example of request body:
JSON Response { "type":2, "video":"http://xxx.xxx.com/xxxx", "userId": "testUser", "did": "868034031518269", "dtype": "1" }
-
Request signature:
When the user requests the Video Submit API, the request can be signed with the appId and secretKey (obtained from the Console - Service Configuration). When the API receives the request with the signature information, it will verify the signature using the same algorithm, and if the signature is found to be inconsistent, the API will return 401 error to the user. If the API validates the signature to be consistent and the user corresponding to the appId has permission to operate the requested resource, then the request succeeds, otherwise the API returns 401 error.
- Send signatures by HTTP Request Headers
Method: Add a header named Authorization in the request, whose value is the signature value. For example:
Authorization: *****
- Signature calculation method
- Canonicalized Query String Convert the request body JSON string to a hexadecimal string (not Base64) by doing sha256 encoding with UTF-8 character encoding.
CanonicalizedQueryString = hex(sha256(jsonBody))
2.Constructs the signed string StringToSign ("\n" stands for ASCII newline character):
StringToSign = HTTPMethod + "\n" +
HostHeaderInLowercase + "\n" +
HTTPRequestURI + "\n" +
CanonicalizedQueryString <Get from the previous step> + "\n" +
"X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
"X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER
HTTPRequestURI is the absolute path to the request URI, not containing the CanonicalizedQueryString. If the HTTPRequestURI is empty, a forward slash (/) will be retained.
The hash-based message authentication code (HMAC) is created using the HMAC-SHA256 protocol and then the signature is calculated.
-
StringToSign serves as the signature string, secretKey serves as the secret key and SHA256 serves as the hash algorithm
For more information about HMAC, see: https://tools.ietf.org/html/rfc2104。
-
Converting the results of the previous step to a BASE64 string
-
Put the BASE64 string into the Authorization of HTTP request Header
- Example of signature
Below is an example of appId & secretKey & video
appId=***
secrectKey=****
video_url="http://xxx.xxx.com/xxxx"
Below is an example of request body.
{
"type": 1,
"video":"http://xxx.xxx.com/xxxx",
"userId": "12345678"
}
Generate CanonicalizedQueryString
b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
Generate StringToSign
POST
vsafe.ilivedata.com
/api/v1/video/check/submit
b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
X-AppId:***
X-TimeStamp:2020-07-31T07:59:03Z
Signatures from HMAC calculations
*****