Check Notice Url

Introduction

  1. Step1: Validate the legality of the callback address check notice url through the interface check noticeUrl.
  2. Step2: Add the noticeUrl field to the submit task interface to set the callback address.
  3. Step3: The callback interface receives data. Topview Server will send the result data of the query task interface to ${noticeUrl}.
# The Topview Server sends a request to the noticeUrl of the Customer Server.
curl --location --request POST '${noticeUrl}' \
--header 'Topview-Uid: ${TOPVIEW_UID}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "uuid":${noticeUuid},
    "bizType":"SCRAPER / ZERO_SHOT_AVATAR / M2V_PREVIEW / M2V_EXPORT",
    "taskId":${taskId},
    "status":"success / fail",
    "errorMsg":"error message",
    "result":"query task result json object"
}'
  1. Step4: The callback interface returns data. The callback interface needs to return response data to the Topview Server.
# The response result returned by the callback of the Customer Server.
{
    "code": "200",
    "message": "Success",
    "result": {
        "uuid": "${noticeUuid}",
        "topviewUid": "${TOPVIEW_UID}",
        "result": "success / fail"
    }
}

Timing Diagram

NoticeBizType

bizType
SCRAPER
ZERO_SHOT_AVATAR
M2V_PREVIEW
M2V_EXPORT
M2V_SCRIPT
PRODUCT_AVATAR_REPLACE_PRODUCT_IMAGE
PRODUCT_AVATAR_IMAGE2VIDEO
PRODUCT_ANY_SHOOT
COMMON_TASK_IMAGE2VIDEO
COMMON_TASK_TEXT2VIDEO
COMMON_TASK_TEXT2IMAGE
COMMON_TASK_VIDEO2AIAVATAR
VOICE_CLONE
VOICE_TEXT2VOICE

For example

Step1: The noticeUrl is http://127.0.0.1:8080/notice. Assume that the check notice url is called to validate its legality. Step2: Add noticeUrl to the Avatar Marketing Video - submit task API interface.

curl --location --request POST 'https://api.topview.ai/v1/m2v/task/submit' \
--header 'Topview-Uid: NsDAaOPF4jLu' \
--header 'Authorization: Bearer sk-vEsneECh1J5eKHUw4vxHI61e7' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: ec2-3-94-88-102.compute-1.amazonaws.com:8095' \
--header 'Connection: keep-alive' \
--data-raw '{
    "productLink": "xxx",
    "voiceId": "xxx",
    "aiavatarId": "xxx",
    "preview": true,
    "noticeUrl":"http://127.0.0.1:8080/notice"
}'

Step3: Assuming the query result for Avatar Marketing Video - query task is as follows:

{
    "code": "200",
    "message": "Success",
    "result": {
        "taskId": "0d3a303bfc1f4f0e9a287ba47dbbefbc",
        "status": "success",
        "errorMsg": null,
        "exportVideos": [
            {
                "scriptId": 0,
                "status": null,
                "title": null,
                "description": null,
                "videoUrl": null,
                "coverUrl": null,
                "videoDuration": null
            }
        ],
        "previewVideos": [
            {
                "scriptId": 0,
                "status": "success",
                "title": null,
                "description": null,
                "videoUrl": "https://aigc.s3.amazonaws.com/analyzed_video/task/export/487a84446461405088b751861d497dfd_topview.ai.mp4",
                "coverUrl": "https://aigc.s3.amazonaws.com/analyzed_video/task/export/487a84446461405088b751861d497dfd.jpg",
                "videoDuration": 36096000
            }
        ]
    }
}

Then the result received by the noticeUrl interface is:

# The Topview Server sends a request to the noticeUrl of the Customer Server.
curl --location --request POST 'http://127.0.0.1:8080/notice' \
--header 'Topview-Uid: NsDAaOPF4jLu' \
--header 'Content-Type: application/json' \
--data-raw '{
    "uuid":"d7ab437f2aa24ed2846486a001376c3a",
    "bizType":"M2V_PREVIEW",
    "taskId":"1a019a9be0cd4d79838671e53af2c20d",
    "status":"success",
    "errorMsg":"",
    "result":"{\"previewVideos\":[{\"coverUrl\":\"https://aigc.s3.amazonaws.com/analyzed_video/task/export/487a84446461405088b751861d497dfd.jpg\",\"scriptId\":0,\"status\":\"success\",\"videoDuration\":36096000,\"videoUrl\":\"https://aigc.s3.amazonaws.com/analyzed_video/task/export/487a84446461405088b751861d497dfd_topview.ai.mp4\"}],\"status\":\"success\",\"taskId\":\"1a019a9be0cd4d79838671e53af2c20d\"}"
}'

Step4: At the same time, the callback interface returns response data.

# The response result returned by the callback of the Customer Server.
{
    "code": "200",
    "message": "Success",
    "result": {
        "uuid": "d7ab437f2aa24ed2846486a001376c3a",
        "topviewUid": "NsDAaOPF4jLu",
        "result": "success"
    }
}
Language
Click Try It! to start a request and see the response here!