tencent cloud

Feedback

Querying File Moderation Job Result

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

    Feature Overview

    This API is used to query the result of the specified document moderation job.
    Note:
    Document moderation results are retained for one month, so you can query moderation results in the past month through this API.

    SDK Recommendation

    COS SDK provides complete capabilities of demo, automatic integration, and signature calculation. You can easily and quickly call APIs through the SDK. For more information, see SDK Overview.

    Request

    Sample request

    GET /document/auditing/<jobId> HTTP/1.1
    Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
    Date: <GMT Date>
    Authorization: <Auth String>
    Note:
    Authorization: Auth String (see Request Signature for more information)
    When this feature is used by a sub-account, relevant permissions must be granted as instructed in Authorization Granularity Details.

    Request headers

    This API only uses Common Request Headers.

    Request body

    This request does not have a request body.

    Response

    Response headers

    This API only returns Common Response Headers.

    Response body

    The response body returns application/xml data. The following contains all the nodes:
    <Response>
    <JobsDetail>
    <JobId>aab1ca9fc8a3ed11ea834c525400863904</JobId>
    <State>Success</State>
    <Code>Success</Code>
    <Message>Success</Message>
    <DataId></DataId>
    <Suggestion>1</Suggestion>
    <CreationTime>2019-07-07T12:12:12+0800</CreationTime>
    <Url>http://www.test.com/123</Url>
    <PageCount>3</PageCount>
    <Labels>
    <PornInfo>
    <HitFlag>1</HitFlag>
    <Score>96</Score>
    </PornInfo>
    </Labels>
    <PageSegment>
    <Results>
    <Url></Url>
    <Text></Text>
    <PageNumber>1</PageNumber>
    <SheetNumber>1</SheetNumber>
    <PornInfo>
    <HitFlag></HitFlag>
    <SubLabel></SubLabel>
    <Score></Score>
    <OcrResults>
    <Text></Text>
    <Keywords></Keywords>
    </OcrResults>
    </PornInfo>
    </Results>
    </PageSegment>
    </JobsDetail>
    <RequestId></RequestId>
    </Response>
    The nodes are as described below:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Response
    None
    Full information of document moderation.
    Container
    Response has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    JobsDetail
    Response
    Details of the document moderation job.
    Container
    RequestId
    Response
    ID automatically generated by the server for a request when the request is sent, which can be used to facilitate fault locating.
    String
    JobsDetail has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Code
    Response.JobsDetail
    Error code, which will be returned only if State is Failed. For more information, see Error Codes.
    String
    Message
    Response.JobsDetail
    Error message, which will be returned only if State is Failed.
    String
    DataId
    Response.JobsDetail
    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
    JobId
    Response.JobsDetail
    ID of the document moderation job.
    String
    State
    Response.JobsDetail
    Job status. Valid values: Submitted, Success, Failed, Auditing.
    String
    Suggestion
    Response.JobsDetail
    This field indicates the moderation result. You can perform subsequent operations based on the result. We recommend you handle different results based on your business needs.
    Valid values: 0 (normal), 1 (sensitive), 2 (suspiciously sensitive, with human review recommended).
    Integer
    Label
    Response.JobsDetail
    This field is used to return the maliciousness label with the highest priority in the detection result, which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions based on your business needs. Return values: Normal, Porn, Ads, and other types of unsafe or inappropriate content.
    String
    CreationTime
    Response.JobsDetail
    Job creation time
    String
    Object
    Response.JobsDetail
    If the moderated file is a file stored in COS, this field indicates its filename.
    String
    Url
    Response.JobsDetail
    The URL of the file to be moderated, which will be returned if Url is selected during job creation.
    String
    PageCount
    Response.JobsDetail
    Document moderation converts a document to images for moderation. This field indicates the total number of generated images.
    Integer
    Labels
    Response.JobsDetail
    This field is used to return the hit moderation scenes and corresponding results.
    Container
    PageSegment
    Response.JobsDetail
    Specific moderation result of each image after the document is converted to images.
    Container
    UserInfo
    Response.JobsDetail
    Business field. This field will not exist if UserInfo is not set during job creation.
    Container
    ListInfo
    Response.JobsDetail
    Blocklist/Allowlist status of the account.
    Container
    ForbidState
    Response.JobsDetail
    If you set automatic freezing, this field indicates the status of the document. 0: not frozen; 1: frozen, 2: file moved.
    Integer
    Labels has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    PornInfo
    Response.JobsDetail.Labels
    The moderation result of the pornographic information moderation scene.
    Container
    AdsInfo
    Response.JobsDetail.Labels
    The moderation result of the advertising information moderation scene.
    Container
    PornInfo and AdsInfo have the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    HitFlag
    Response.JobsDetail.Labels.*Info
    The moderation result returned for the moderation scene. Return values:
    0: Normal.
    1: Confirmed as a violation of the current scene.
    2: Suspected as a violation of the current scene.
    Integer
    Score
    Response.JobsDetail.Labels.*Info
    The confidence the moderation result hits the moderation scene. Value range: 0–100. The higher the value, the more likely the content hits the currently returned moderation scene.
    For example, Porn 99 means that the content is very likely to be pornographic.
    Integer
    PageSegment has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Results
    Response.JobsDetail.PageSegment
    Detailed moderation result of each image after the document is converted to images.
    Container Array
    Results has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Url
    Response.JobsDetail.PageSegment.Results
    After the document is converted to images, you can view the image content at this URL. It must be a standard URL.
    Note: Each URL is valid for two hours. If you need to view the data after two hours, initiate a new query request.
    String
    Text
    Response.JobsDetail.PageSegment.Results
    This field is used to return the OCR text recognition result of the current image. It will be returned only if text content detection is enabled in the moderation policy.
    String
    PageNumber
    Response.JobsDetail.PageSegment.Results
    Number of images, which is usually the number of pages in the document.
    Integer
    SheetNumber
    Response.JobsDetail.PageSegment.Results
    If the moderated file is a spreadsheet, this field indicates the number of sheets.
    Integer
    Label
    Response.JobsDetail.PageSegment.Results
    This field is used to return the maliciousness label with the highest priority in the detection result, which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions based on your business needs.
    Return values: Normal, Porn, Ads, and other types of unsafe or inappropriate content.
    String
    Suggestion
    Response.JobsDetail.PageSegment.Results
    This field indicates the moderation result. You can perform subsequent operations based on the result. We recommend you handle different results based on your business needs.
    Valid values: 0 (normal), 1 (sensitive), and 2 (suspiciously sensitive, with human review recommended).
    Integer
    PornInfo
    Response.JobsDetail.PageSegment.Results
    The moderation result of the pornographic information moderation scene.
    Container
    AdsInfo
    Response.JobsDetail.PageSegment.Results
    The moderation result of the advertising information moderation scene.
    Container
    PornInfo and AdsInfo have the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    HitFlag
    Response.JobsDetail.PageSegment.Results.*Info
    The moderation result returned for the moderation scene. Return values:
    0: Normal.
    1: Confirmed as a violation of the current scene.
    2: Suspected as a violation of the current scene.
    Integer
    Category
    Response.JobsDetail.PageSegment.Results.*Info
    This field is a subset of Label, indicating the specific moderation category hit; for example, Sexy represents the sexy category in the Porn label.
    String
    SubLabel
    Response.JobsDetail.PageSegment.Results.*Info
    This field indicates the specific sub-label hit by the moderation job; for example, SexBehavior is a sub-label under the Porn label.
    Note: This field may return null, indicating that no specific sub-labels are hit.
    String
    Score
    Response.JobsDetail.PageSegment.Results.*Info
    The confidence the moderation result hits the moderation scene. Value range: 0–100. The higher the value, the more likely the content hits the currently returned moderation scene.
    For example, Porn 99 means that the content is very likely to be pornographic.
    Integer
    OcrResults
    Response.JobsDetail.PageSegment.Results.*Info
    This field represents the detailed OCR result, including the text coordinate information and text recognition result. It will be returned if there is non-compliant content.
    Container Array
    OcrResults has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Text
    Response.JobsDetail.PageSegment.Results.*Info.OcrResults
    The specific text content recognized by OCR in the image.
    String
    Keywords
    Response.JobsDetail.PageSegment.Results.*Info.OcrResults
    Keywords hit by the current moderation scene.
    String Array
    Location
    Response.JobsDetail.PageSegment.Results.*Info.OcrResults
    This parameter is used to return the position (X and Y coordinates of the top-left corner, length, width, and rotation angle) of the OCR detection frame in the image for quick location of the recognized text.
    Container
    ObjectResults has the following sub-nodes:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    Name
    Response.JobsDetail.PageSegment.Results.*Info.ObjectResults
    This field is used to return the name of the recognized object, such as person name.
    String
    Location
    Response.JobsDetail.PageSegment.Results.*Info.ObjectResults
    This parameter is used to return the position (X and Y coordinates of the top-left corner, length, width, and rotation angle) of the recognition result in the image for you to quickly locate information.
    Container
    Location has the following sub-nodes:
    Node Name (Keyword)
    Description
    Type
    X
    This parameter is used to return the pixel position of the abscissa (X) of the top-left corner of the detection frame. It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Float
    Y
    This parameter is used to return the pixel position of the ordinate of the top-left corner (Y) of the detection frame. It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Float
    Height
    This parameter is used to return the height of the detection frame (the length starting from the top-left corner and extending down the Y axis). It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Float
    Width
    This parameter is used to return the width of the detection frame (the length starting from the top-left corner and extending to the right on the X axis). It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Float
    Rotate
    This parameter is used to return the rotation angle of the detection frame. Valid values: 0–360 (degrees), and the direction is counterclockwise rotation. This parameter can be combined with the X and Y coordinate parameters to uniquely determine the specific position of the detection frame.
    Float
    UserInfo has the following sub-nodes:
    Node Name (Keyword)
    Description
    Type
    Required
    TokenId
    Account information, which can contain up to 128 bytes.
    String
    No
    Nickname
    Nickname information, which can contain up to 128 bytes.
    String
    No
    DeviceId
    Device information, which can contain up to 128 bytes.
    String
    No
    AppId
    Unique app ID, which can contain up to 128 bytes.
    String
    No
    Room
    Room ID information, which can contain up to 128 bytes.
    String
    No
    IP
    IP address information, which can contain up to 128 bytes.
    String
    No
    Type
    Business type, which can contain up to 128 bytes.
    String
    No
    ReceiveTokenId
    User account to receive messages, which can contain up to 128 bytes.
    String
    No
    Gender
    Gender information, which can contain up to 128 bytes.
    String
    No
    Level
    Level information, which can contain up to 128 bytes.
    String
    No
    Role
    Role information, which can contain up to 128 bytes.
    String
    No

    Error codes

    This API returns uniform error responses and error codes. For more information, see Error Codes.

    Use Cases

    Request

    GET /document/auditing/stb1ca9fc8a34c525400863904**** HTTP/1.1
    Accept: */*
    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

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 666
    Connection: keep-alive
    Date: Thu, 15 Jun 2017 12:37:29 GMT
    Server: tencent-ci
    x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****
    <Response>
    <JobsDetail>
    <JobId>stb1ca9fc8a34c525400863904****</JobId>
    <State>Success</State>
    <Suggestion>1</Suggestion>
    <CreationTime>2019-07-07T12:12:12+0800</CreationTime>
    <Url>http://www.test.com/123.doc</Url>
    <PageCount>3</PageCount>
    <Labels>
    <PornInfo>
    <HitFlag>1</HitFlag>
    <Score>96</Score>
    </PornInfo>
    </Labels>
    <PageSegment>
    <Results>
    <Url>https://examplebucket-1250000000.cos.ap-nanjing.myqcloud.com/audit-1.jpg</Url>
    <Text>Haha, hello</Text>
    <PageNumber>1</PageNumber>
    <PornInfo>
    <HitFlag>0</HitFlag>
    <SubLabel>sex</SubLabel>
    <Score>0</Score>
    <OcrResults>
    <Text>Haha, hello</Text>
    <Keywords>Hello</Keywords>
    </OcrResults>
    </PornInfo>
    </Results>
    <Results>
    <Url>https://examplebucket-1250000000.cos.ap-nanjing.myqcloud.com/audit-2.jpg</Url>
    <Text>Haha, hello</Text>
    <PageNumber>1</PageNumber>
    <PornInfo>
    <HitFlag>0</HitFlag>
    <SubLabel>sex</SubLabel>
    <Score>0</Score>
    <OcrResults>
    <Text>Haha, hello</Text>
    <Keywords>Hello</Keywords>
    </OcrResults>
    </PornInfo>
    </Results>
    </PageSegment>
    </JobsDetail>
    <RequestId>xxxxxxxxxxxxxx</RequestId>
    </Response>
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support