Initialization
Embed the following code within the head tag of the key business entry page
<script type="text/javascript">
(function(){
window._TDBotD = {}
var botd = document.createElement('script');
botd.type = 'text/javascript';
botd.async = true;
botd.src = 'Botd URL' + '?t=' + (new Date().getTime()/3600000).toFixed(0);
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(botd, s);
})();
</script>Botd URL
Interface Signature
if(_TDBotD.sign){
var fingalsign = _TDBotD.sign({
path:'', // Only string types are supported
})
if(fingalsign.code == 0) {
// Get the signature and use it
var sign = fingalsign.sign // The final sign value
} else {
// Obtain error messages and status codes
var msg = fingalsign.msg
// Continue with the business logic. Here, the signature can be replaced by a blank character
var errcode = fingalsign.code
}
}else {
// The interface protection is not initialized
}Parameter
Assume https://baidu.com/user/profile?name=jacy&type=2 against doing interface protection, sample value may refer to:
| Parameter name | Type | Example && Description |
|---|---|---|
| path | String | 'user/profile' |
Status Code
| code | msg |
|---|---|
| 0 | success |
| 2000 | failed, path is empty |
| 2002 | path is not a string |
| 3001 | not supported |
| 3002 | initialization failed |
| 3003 | sign failed |
