Testing Invoice File Upload

Prerequisites


Resource Preparation

Download the following files before testing the API in Postman:


Step 1: Convert Images to Base64

We will use the online tool base64-image.de:

  1. Visit the website and select the file demo_invoice.png.

Website base64-image.de

  1. The website will automatically convert it to Base64.

Convert to Base64

  1. Click </> show code to retrieve the Base64 string.

Click show code

  1. Copy the Base64 code.

Copy Base64

  1. Save it temporarily in Notepad.

  2. Repeat the process for the remaining two files.


Step 2: Create a Postman Collection

  1. Open the Postman application.

Postman

  1. Click the "+" button to create a new collection.

Create new collection

  1. Select Blank Collection.

Blank collection

  1. Name it: InvoiceUploadAPI-Tests

Rename collection


Step 3: Create a Request

  1. Inside the newly created collection, click the "+" button to add a request.

Create request

  1. Name the request: Upload Invoice.

Rename request

  1. Select the POST method.

Choose method post

  1. Go to API Gateway, select the API: PostInvoiceAPI.

PostInvoiceAPI

  1. Navigate to the Stages section.

PostInvoiceAPI

  1. Click the “+” button to reveal the full URL.

PostInvoiceAPI

  1. Select the POST method and copy the Invoke URL.

PostInvoiceAPI

  1. Paste the Invoke URL into Postman as shown:

PostInvoiceAPI

  1. Go to the Headers tab and configure as follows:
Content-Type: application/json

PostInvoiceAPI

  1. Navigate to the Body tab → Select raw → Choose JSON.

PostInvoiceAPI

  1. Paste the following JSON into Postman:
{
    "file": "",
    "filename": ""
}

PostInvoiceAPI

  1. Paste the Base64 string saved earlier in Notepad and specify the filename as follows:

PostInvoiceAPI

PostInvoiceAPI

  1. Click the Send button to view the results.

PostInvoiceAPI

  1. A successful response will appear as follows:

PostInvoiceAPI

  1. Go to S3 → Navigate to the uploads/ folder → Verify the uploaded file.

PostInvoiceAPI

  1. Access DynamoDB → Select Explore items → Choose the InvoiceData table.

PostInvoiceAPI