2017-12-29 25 views
0

これは私が今持っているすべてです。私はjQueryを使用しています。
はまた、私はこのエラーを取得する:PARTNER_AUTHENTICATION_FAILEDDocuSignでエンベロープを作成するためのPOST要求

jQuery(document).ready(function($){ 
    // console.log('DocuSign Script Loaded!'); 

    var accountId = '404569'; 

    // on button click 
    $('#upload_submit').click(function(){ 

     // form inputs 
     // document, emailSubject, status, recipients 
     var name = $('#upload_name').val(); 
     var email = $('#upload_email').val(); 

     $.post("https://na2.docusign.net/restapi/v2/accounts/" + accountId + "/envelopes", { 

     }, 
     function (data) { 
      console.log(data); 
     }); 
    }); 
}); 

答えて

0
<?php 
    // Set Authentication information 
    $email = ''; 
    $password = ''; 
    $integratorKey = ''; 

    function get_url($email, $password, $integratorKey) { 
     // api service point 
     $url = "https://demo.docusign.net/restapi/v2/login_information"; 

     // construct the authentication header: 
     $header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>"; 

     // STEP 1 - Login (to retrieve baseUrl and accountId) 
     $curl = curl_init($url); 
     curl_setopt($curl, CURLOPT_HEADER, false); 
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
     curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header")); 

     $json_response = curl_exec($curl); 
     $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 


     if ($status != 200) { 
      return (['ok' => false, 'errMsg' => "Error calling DocuSign, status is: " . $status]); 
     } 

     $response = json_decode($json_response, true); 

     // Account ID and Base URL for envelopes API 
     $accountId = $response["loginAccounts"][0]["accountId"]; 
     $baseUrl = $response["loginAccounts"][0]["baseUrl"]; 

     curl_close($curl); 

     return $baseUrl; 
    } 

    // Base URL Envelope 
    $baseUrl = get_url($email, $password, $integratorKey); 
0

あなたのコード例は、認証資格情報を提供していません。

+0

こんにちは。答えてくれてありがとう。それ、どうやったら出来るの? –

+0

@DragiPostolovski - https://docs.docusign.com/design/guide/authentication/auth_overview.htmlを参照してください。 質問や問題がある場合は、新しい質問を開きます。そして、これがあなたのための正しい答えだったら、それを確認して「受け入れてください」。 –

関連する問題