OneSpan Sign How To: Using Postman To Test OneSpan Sign's API

Haris Haidary,

Postman is an HTTP client application designed for testing web services. In other words, it is a tool that is useful for development and testing of RESTful APIs. Postman makes it easy to test, develop and document APIs by allowing users to quickly put together both simple and complex HTTP requests.

It has a very simple, clean and intuitive user interface that allows users to start building and testing API calls very quickly. Also, all API calls sent through Postman are stored in history, which saves you time by eliminating the need to retype entire API calls. Finally, the response viewer allows you to easily read the response sent back from whichever API you are calling to. In this blog, I will show you how to create and send a package using Postman.

Create and Send A Package

If you don't already have Postman installed on your computer, you can download it for free from the following link.

The first thing you'll want to do is select "POST" as the HTTP method and enter "https://sandbox.esignlive.com/api/packages/" as the request URL. Then, select the Headers tab and add the following two headers:

 

Authorization Basic api_key
Accept application/json

 

Make sure to replace the api_key placeholder with your own value. Here's what your Postman should look like so far:

1

Next, select the Body tab and choose "form-data" as the body type. Enter "file" as the first key and change the corresponding value type to "file". Select "Choose Files" and browse to the document you want to upload. Then, enter "payload" as the second key and copy-paste the example JSON below:


{
  "documents": [
    {
      "approvals": [
        {
          "id": "ExampleSignatureId",
          "role": "Signer1",
          "fields": [
            {
              "page": 0,
              "top": 200,
              "subtype": "LABEL",
              "height": 50,
              "left": 100,
              "width": 200,
              "id": "myLabelField",
              "type": "INPUT",
              "value": "Example label field value"
            },
            {
              "page": 0,
              "top": 100,
              "subtype": "FULLNAME",
              "height": 50,
              "left": 100,
              "width": 200,
              "type": "SIGNATURE",
              "name": "ExampleSignatureId"
            }
          ],
          "name": ""
        }
      ],
      "id": "sample-contract",
      "name": "Test Document"
    }
  ],
  "status": "DRAFT",
  "type": "PACKAGE",
  "roles": [
    {
      "id": "Signer1",
      "type": "SIGNER",
      "signers": [
        {
          "email": "[email protected]",
          "firstName": "John",
          "lastName": "Smith",
          "id": "Signer1"
        }
      ],
      "name": "Signer1"
    }
  ],
  "name": "Example Package"
}

Here's what your Body tab should look like:

2

Now, you are ready to send your request. Click on the Send button. OneSpan Sign will then return you a package id as a response, which will be printed in the response viewer, as shown below:

3

If you have questions regarding this blog or anything else concerning integrating OneSpan Sign into your application, visit the developer community forums: https://developer.OneSpan.com.

That's it from me. Thank you for reading! If you found this post helpful, please share it on Facebook, Twitter, or LinkedIn.

Haris Haidary
Junior Technical Evangelist
LinkedIn | Twitter 

 

OneSpan Developer Community

OneSpan Developer Community

Join the OneSpan Developer Community! Forums, blogs, documentation, SDK downloads, and more.

Join Today