2016-07-07 96 views
1

由於客戶端已經使用Smartsheets並且我們的原型有點笨拙,因此用Smartsheets替換我們現有的接口將非常有用。爲此,我構建了一個原型,以便學習Smartsheet API,並在嘗試設置webhook時斷開原型。Smartsheet - SSL握手期間發生錯誤

這裏的輸出,當我嘗試更新/啓用網絡掛接:

{"message": "SUCCESS", 
"resultCode": 0, 
"result": { 

"id": 4253946970695556, 
"name": "Webhook_test", 
"apiClientId": "3oqnphhimgqzyimk40", 
"apiClientName": "ChoiceIP", 
"scope": "sheet", 
"scopeObjectId": 7055538769946500, 
"events": [ 
    "*.*" 
], 
"callbackUrl": "https://ghwd.net/write_requests_to_log.php", 
"sharedSecret": "kpnc4nz7gwy91yjzcah2s6neq", 
"enabled": false, 
"status": "DISABLED_VERIFICATION_FAILED", 
"disabledDetails": "An error occurred during SSL handshake. (ref id: fwhc0949r7km)", 
"version": 1, 
"createdAt": "2016-07-06T12:04:13Z", 
"modifiedAt": "2016-07-07T06:04:20Z" 
    } 
} 

下面是一個應該創建響應腳本代碼:

$headers = getallheaders(); 

if(isset($headers['smartsheet-hook-challenge'])) { 

header("Smartsheet-Hook-Response: " . $headers['smartsheet-hook-challenge']); 
echo $headers['smartsheet-hook-challenge']; 
return; 

} else if(isset($_POST['smartsheet-hook-challenge'])) { 

header("Smartsheet-Hook-Response: " . $_POST['smartsheet-hook-challenge']); 
echo $_POST['smartsheet-hook-challenge']; 
return; 

} else { 

header("Smartsheet-Hook-Response: debug"); 

} 

爲什麼SSL握手失敗?

回答

2

您需要爲域ghwd.net設置有效的SSL證書設置,或使用具有有效SSL證書的域。

當您創建webhook時,Smartsheet將首先嚐試通過安全連接連接到您的回調URL。如果無法建立安全連接,則會按照您所看到的狀態禁用webhook,DISABLED_VERIFICATION_FAILED

Smartsheet Webhook Documentation

+2

爲了增加Brett的答案,Smartsheet不支持自簽名證書。它必須由第三方CA簽署。我們剛剛更新了文檔以記錄這一點。 – KevinT