1 2 Previous Next 43 Replies Latest reply on Jul 14, 2017 1:50 PM by someo27067628

    Invalid API Key Error in Ecosign API

    sathishk87537414 Level 1

      I'm using the sample soap code(Developer kit) given by echosign api for testping, but it always show invalid api key error while i'm executing from terminal. Please give the solution as soon as possible, and i'm not able to get solution from google also.

       

      This is my API Key:

       

      Client Secret:6IaJHev8N48JbsZcM4Itggzt0pAHF0iS

       

      I tried with this comment in terminal:

       

      php demo.php https://secure.echosign.com/services/EchoSignDocumentService20?wsdl 6IaJHev8N48JbsZcM4Itggzt0pAHF0iS test

       

       

      This is demo.php file:

       

      <?php

      // get input

      array_shift($_SERVER['argv']);

      $Url = array_shift($_SERVER['argv']);

      $ApiKey = array_shift($_SERVER['argv']);

      $cmd = array_shift($_SERVER['argv']);

      $params = $_SERVER['argv'];

       

      if (!$cmd) print_usage();

       

      $S = new SOAPClient($Url);

      call_user_func("cmd_$cmd", $params);

       

      function cmd_test() {

          global $Url, $ApiKey, $S;

       

          print "Testing basic connectivity...\n";

          $r = $S->testPing(array('apiKey' => $ApiKey));

          print "Message from server: {$r->documentKey->message}\n";

          print "Testing file transfer...\n";

          $text = file_get_contents('../test.pdf');

          $r = $S->testEchoFile(array('apiKey' => $ApiKey, 'file' => base64_encode($text)))->outFile;

       

          if (base64_decode($r) === $text) {

              print "Woohoo! Everything seems to work.\n";

          }

          else {

              die("ERROR: Some kind of problem with file transfer, it seems.\n");

          }

      }

       

       

      function cmd_send() {

          global $Url, $ApiKey, $S;

       

       

          list($filename, $recipient) = reset(func_get_args());

       

          $r = $S->sendDocument(array(

              'apiKey' => $ApiKey,

              'documentCreationInfo' => array(

                      'fileInfos' => array(

                          'FileInfo' => array(

                              'file'     => file_get_contents($filename),

                              'fileName' => $filename,

                          ),

                      ),

                      'message' => "This is neat.",

                      'name'    => "Test from SOAP-Lite: $filename",

                      'signatureFlow' => "SENDER_SIGNATURE_NOT_REQUIRED",

                      'signatureType' => "ESIGN",

                      'tos' => array( $recipient ),

                  ),

              )

          );

       

          print "Document key is: {$r->documentKeys->DocumentKey->documentKey}\n";

      }

       

       

      function cmd_info() {

          global $Url, $ApiKey, $S;

       

       

          list($doc_key) = reset(func_get_args());

          $r = $S->getDocumentInfo(array('apiKey' => $ApiKey, 'documentKey' => $doc_key))->documentInfo;

       

       

          print "Document is in status: {$r->status}\n";

          print "Document History: ";

          foreach($r->events->DocumentHistoryEvent as $_) {

              $keytext =

                $_->documentVersionKey

                ? " (versionKey: {$_->documentVersionKey})"

                : '';

              print "{$_->description} on {$_->date}$keytext\n";

          }

          print "Latest versionKey: {$r->latestDocumentKey}\n";

      }

       

       

      function cmd_latest() {

          global $Url, $ApiKey, $S;

       

       

          list ($doc_key, $filename) = reset(func_get_args());

          $r = $S->getLatestDocument(array('apiKey' => $ApiKey, 'documentKey' => $doc_key))->pdf;

          //$r = base64_decode($r);

          file_put_contents($filename, $r);

      }

       

       

      function print_usage() {

          die(<<<__USAGE__

      Usage:

        demo.php <URL> <API key> <function> [parameters]

       

       

      where the function is one of:

        test

        send <filename> <recipient_email>

        info <documentKey>

        latest <documentKey> <filename>

       

       

      test will run basic tests to make sure you can communicate with the web service

      send will create a new agreement in the EchoSign system, and returns a documentKey

      info returns the current status and all the history events for a given documentKey

      latest saves the latest version of the document as a PDF with the given filename

       

       

      __USAGE__

      );

      }

       

       

      --------------------------  End of file ---------------------------------------------------------------

        1 2 Previous Next