POST a JSON object in a form data request

Hi
Can anyone assist on how to post this data in Postman via a form-data Post call

{
  "title": "Example document",
  "message": "Lorem ipsum solar sit amet.",
  "file": "encoded",
  "recipients": [{
    "first_name": "John",
    "last_name": "Doe",
    "email": "example@pleasesign.com.au",
    "tabs": [{
      "kind": "signature",
      "page": 1,
      "x": 100,
      "y": 800
    }]
  }]
} 

Thanks

That is complex JSON. Array’s within array, so I doubt it’s mean to be form data.

It might require parts of it to be stringified, but I suspect this should be sent as RAW\JSON.

To confirm, we would need to see the API specification which should explain what the request needs or will accept.

Do you have any documentation for the API?

Hi Mike
Here is the documentation
https://docs.pleasesign.com.au/#create-document
And it needs to be formdata as we need to pass a file with the json

I think that @michaelderekjones is right here about the payload structure.

From the docs, I believe the file needs to be base64 encoded and added to the raw JSON payload as a string on the file property.

file: The base64 encoded string of bytes containing the PDF file to be used.

There are tools like PDF to Base64 Encode - Online Tool that could help you to convert that file type. As that’s a 3rd party online tool, I would make sure that what you’re not sending anything sensitive over to it.

1 Like

If the data isn’t confidential, you can send it to Postman Echo which will return the base64 encoded string.

You should be able to parse the response and store the base64 string in a collection or environment variable which can be used in the request to the Pleasesign API.

An example response.

Have a look at the first part of the following Youtube clip to see this in action.

How to Upload, Download, and Preview Files (PDFs) with Postman - YouTube

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.