tencent cloud

Feedback

Submitting File Moderation Job

Last updated: 2024-06-12 16:01:53

    Feature Description

    This API is used to submit a file moderation job. The file moderation feature is async. You can submit a job to moderate your files, and then use the file moderation job querying API or file moderation callback API to query the moderation results.
    Note:
    Moderate files stored in COS.
    Moderate files at URLs of a third-party cloud storage vendor.
    Currently supported input file types include:
    Presentation files: PPTX, PPT, POT, POTX, PPS, PPSX, DPS, DPT, PPTM, POTM, PPSM.
    Text files: DOC, DOT, WPS, WPT, DOCX, DOTX, DOCM, DOTM.
    Spreadsheet files: XLS, XLT, ET, ETT, XLSX, XLTX, CSV, XLSB, XLSM, XLTM, ETS.
    Other files: PDF.
    A spreadsheet file may be split into multiple pages, with multiple images generated.
    The input file size cannot exceed 200 MB.
    The number of pages in the input file cannot exceed 5,000.
    Customize moderation policies based on different business scenarios.

    Request

    Sample request

    POST /document/auditing HTTP/1.1
    Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
    Date: <GMT Date>
    Authorization: <Auth String>
    Content-Length: <length>
    Content-Type: application/xml
    
    <body>
    Note:
    Authorization: Auth String (for more information, see Request Signature).

    Request headers

    This API only uses common request headers. For more information, see Common Request Headers.

    Request body

    This request requires the following request body:
    <Request>
    <Input>
    <Url></Url>
    <Type></Type>
    <DataId></DataId>
    </Input>
    <Conf>
    <DetectType></DetectType>
    <Callback></Callback>
    <BizType></BizType>
    </Conf>
    </Request>
    The nodes are described as follows:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Required
    Request
    None
    File moderation configuration.
    Container
    Yes
    Request has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Required
    Input
    Request
    Content to be moderated.
    Container
    Yes
    Conf
    Request
    Moderation rule configuration.
    Container
    Yes
    Input has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Required
    Object
    Request.Input
    Name of the file stored in the COS bucket; for example, if the file is test.doc in the test directory, then the filename is test/test.doc. Either Object or Url can be selected at a time.
    String
    No
    Url
    Request.Input
    Full URL of the file, such as http://www.example.com/doctest.doc. Either Object or Url can be selected at a time.
    String
    No
    Type
    Request.Input
    File type. If this parameter is not specified, the file extension will be used as the type by default, such as DOC, DOCX, PPT, and PPTX.
    If the file has no extension, this field must be specified; otherwise, moderation will fail.
    String
    No
    DataId
    Request.Input
    This field will return the original content in the moderation result, which can contain up to 512 bytes. You can use this field to uniquely identify the data to be moderated in your business.
    String
    No
    UserInfo
    Request.Input
    Business field.
    Container
    No
    UserInfo has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Required
    TokenId
    Request.Input.UserInfo
    Business TokenId, which can contain up to 128 bytes.
    String
    No
    Nickname
    Request.Input.UserInfo
    Business Nickname, which can contain up to 128 bytes.
    String
    No
    DeviceId
    Request.Input.UserInfo
    Business DeviceId, which can contain up to 128 bytes.
    String
    No
    AppId
    Request.Input.UserInfo
    Business AppId, which can contain up to 128 bytes.
    String
    No
    Room
    Request.Input.UserInfo
    Business Room, which can contain up to 128 bytes.
    String
    No
    IP
    Request.Input.UserInfo
    Business IP, which can contain up to 128 bytes.
    String
    No
    Type
    Request.Input.UserInfo
    Business Type, which can contain up to 128 bytes.
    String
    No
    Conf has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Required
    BizType
    Request.Conf
    Unique identifier of the moderation policy. You can configure the scenes you want to moderate on the moderation policy page in the console, such as pornographic, adverting, and illegal information. For configuration guidelines, see Setting Public Moderation Policy. You can get BizType in the console. If BizType is specified, the moderation request will perform moderation according to the scenes configured in the moderation policy.
    If BizType is not specified, the default moderation policy will be used automatically.
    String
    No
    DetectType
    Request.Conf
    The scene to be moderated, such as Porn (pornography) and Ads (advertising). This parameter will no longer be maintained in the future. You can pass in multiple types and separate them by commas, such as Porn,Ads. If you need to moderate more scenes, use the BizType parameter.
    String
    No
    Callback
    Request.Conf
    The moderation result can be sent to your callback address in the form of a callback. Addresses starting with http:// or https:// are supported, such as http://www.callback.com.
    String
    No

    Response

    Response headers

    This API only returns common response headers. For more information, see Common Response Headers.

    Response body

    The response body returns application/xml data. The following contains all the nodes:
    <Request>
    <JobsDetail>
    <DataId></DataId>
    <JobId></JobId>
    <State></State>
    <CreationTime></CreationTime>
    </JobsDetail>
    <RequestId></RequestId>
    </Request>
    The nodes are as described below:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Response
    None
    Specific response content for the submitted file moderation job.
    Container
    Response has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    JobsDetail
    Response
    Details of the file moderation job.
    Container
    RequestId
    Response
    The ID automatically generated by the server for a request when the request is sent, which can help locate problems faster.
    String
    JobsDetail has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    DataId
    Response.JobsDetail
    Unique business ID added in the request.
    String
    JobId
    Response.JobsDetail
    ID of the file moderation job.
    String
    State
    Response.JobsDetail
    Status of the file moderation job. Valid values: Submitted, Success, Failed, Auditing.
    String
    CreationTime
    Response.JobsDetail
    Creation time of the file moderation job.
    String

    Error codes

    There are no special error messages for this request. For common error messages, see Error Codes.

    Samples

    Request

    POST /document/auditing HTTP/1.1
    Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0e****
    Host: examplebucket-1250000000.ci.ap-beijing.myqcloud.com
    Content-Length: 166
    Content-Type: application/xml
    <Request>
    <Input>
    <Url>http://www.example.com/doctest.doc</Url>
    <DataId>123-fdrsg-123</DataID>
    </Input>
    <Conf>
    <DetectType>Porn,Ads</DetectType>
    <Callback></Callback>
    <BizType>b81d45f94b91a683255e9a9506f4****</BizType>
    </Conf>
    </Request>

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 230
    Connection: keep-alive
    Date: Thu, 15 Jun 2017 12:37:29 GMT
    Server: tencent-ci
    x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****
    
    <Response>
    <JobsDetail>
    <DataId>123-fdrsg-123</DataID>
    <JobId>vab1ca9fc8a3ed11ea834c52540086****</JobId>
    <State>Submitted</State>
    <CreationTime>2019-07-07T12:12:12+0800</CreationTime>
    </JobsDetail>
    <RequestId>xxxxxxxxxxxxxx</RequestId>
    </Response>