fbpx

Rest API Examples using Postman

Before you using EzzyBills, you will need to have an EzzyBills account. If you do not have one, go to www.ezzybills.com to sign up a free trial. Then manually upload several files to EzzyBills – this way, you will have several invoices that you can retrieve.

Please try the following examples below in sequence.  Download Collection (zip file)

Example 1: Connect to EzzyBills

  • Click + to create a new request,
  • Choose GET, 
  • Enter request URL: https://app.ezzydoc.com/EzzyService.svc/Rest/Login
  • Click Params  (to the right of the URL), and put in three sets of keys:  user, pwd, and APIKeys (case sensitive)
  • Enter nothing in Authorization and Headers
  • Click Send in the end.

In the response window below, you will see a response “1”. It means successful.

See screenshots below:

Example 2: Upload an invoice file to EzzyBills

  • Click + to create a new request,
  • Choose POST, 
  • Enter request URL: https://app.ezzydoc.com/EzzyService.svc/Rest/uploadInvoiceImage
  • Click Params  (to the right of the URL), and put in one set of key:  APIKeys (case sensitive)

Note that the other two keys (user and pwd) are already saved in the Cookies.

  • Enter in the Headers one set of key – screenshot below.

  • Enter in the Body the text string below:

{“PictureName”:”taxinvoice.pdf”,”PictureStream”:[37,80,68,70,45,49,46,55,13,10,37,181,181,181,181,13]}

Replace the green number in the bracket with a byte array representation of the image you are uploading. This is to upload a pdf file called “taxinvoice.pdf”.

Click this link to download a sample byte array representation of a test PDF invoice.

  • Click Send in the end.

In the response window below, you will see a response containing three variables: invoice_id, message and status (0, zero, indicating successful).

See screenshots below:

Example 3: Get last 10 invoice files from EzzyBills

  • Click + to create a new request,
  • Choose GET, 
  • Enter request URL: https://app.ezzydoc.com/EzzyService.svc//Rest/getMyInvoiceQueue
  • Click Params  (to the right of the URL), and put in 4 sets of key:  page, size, filter, APIKey (screenshot below)

Note that the other two keys (user and pwd) are already saved in the Cookies.

  • Click Send.

In the response window, you will see a response containing data for the last 10 invoices from EzzyBills.

See screenshots below:

Example 4: How to generate Postman PDF Data

The easiest way to create the data to upload via postman is to use python. You can Install python on your computer then run the following script. The script will read your PDF then generate a raw.txt file (byte array representation of the PDF file) which can be uploaded to the postman collection.

import json
with open('test.pdf', 'rb') as img_file:
img_name = 'test.pdf'
data = img_file.read()
b = bytearray(data)
li = []
for i in b:
li.append(i)

raw_data = {"PictureName": "test.pdf", "PictureStream": li}
json_data = json.dumps(raw_data)

with open("raw.txt", 'w') as file_object:
file_object.write(json_data)

D:\python>python generatestream.py

This will generate a file which contains what you need to add to the postman collection.