当您通过上述步骤完成 API 接入后,可通过如下方式验证文本内容检测服务是否接入成功。
接入成功
若 Response 回参没有“Error”字段且正常返回业务参数,则说明 TMS 接口接入成功,示例如下所示:
{"Response": {"DataId": "123","Extra": "xx","BizType": "0","RiskDetails": [{"Level": 2,"Label": "RiskAccount"}],"DetailResults": [{"LibName": "Porn","Score": 72,"Label": "Porn","LibId": "12","Suggestion": "Review","Keywords": ["色情"],"LibType": 0},{"LibName": "Porn","Score": 0,"Label": "","LibId": "1","Suggestion": "Block","Keywords": ["色情"],"LibType": 2}],"Label": "Ad","Score": 87,"RequestId": "x2123-123123-123","Suggestion": "Block","Keywords": ["加我好友,给你发优惠券"]}}
接入失败
若 Response 回参显示“Error”字段,则说明接入失败,以下为 signature 校验失败的示例:
{"Response": {"Error": {"Code": "AuthFailure.SignatureFailure","Message": "The provided credentials could not be validated. Please check your signature is correct."},"RequestId": "ed93f3cb-f35e-473f-b9f3-0d451b8b79c6"}}