|
| 1 | + |
| 2 | + |
| 3 | +## Low-code Automation with Make.com and pdfRest |
| 4 | + |
| 5 | + |
| 6 | +[Make.com](https://www.make.com/) (formerly Integromat) is a convenient web application for streamlining the creation of automated workflows. Its web interface supports low/no-code incorporation of a wide variety of services. While pdfRest is not currently listed within their available services, pdfRest is callable via the built-in HTTP module, allowing for easy integration within Make scenarios. |
| 7 | + |
| 8 | +To get started, take a minute and [sign up for a free Starter account](https://pdfrest.com/getstarted/) with pdfRest to generate a dedicated API Key, which will be required for sending calls to the service. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Objective |
| 13 | + |
| 14 | +This tutorial will demonstrate how to: |
| 15 | + |
| 16 | +1. Create a scenario that watches a Google Drive folder for new files. |
| 17 | +2. Upload the files to the pdfRest API. |
| 18 | +3. Process the uploaded files by compressing them with pdfRest. |
| 19 | +4. Retrieve the processed files and upload them to a different Google Drive folder. |
| 20 | + |
| 21 | + |
| 22 | +--- |
| 23 | +## Step 1: Connect pdfRest to Google Drive |
| 24 | + |
| 25 | +Begin by creating a new **Scenario**, either by clicking **+ Create scenario** (in the upper-right corner) or by opening the **Scenario Builder** in **Scenarios**. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +Before calling pdfRest, you will need to access your input file from an app such as Google Drive or OneDrive. This example will use Google Drive to watch a folder for newly created files. See [Make’s documentation](https://help.make.com/connect-to-google-services-using-a-custom-oauth-client) for directions on how to configure access to your particular file source. |
| 30 | + |
| 31 | +In the new scenario view, click the **+ button** in the center to begin adding apps. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +Use the search field to locate and select the **Google Drive** app. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +View the available actions in the Google Drive app, either by clicking on **Google Drive** or by clicking **Show more**. Locate and select **Watch Files in a Folder**. |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +Set **Connection** to your configured connection to Google Drive. In **Select the Folder to be Watched**, set the folder you wish to contain your input document(s). |
| 44 | + |
| 45 | +Set **Limit** to the maximum number of files to be processed per each scenario run. (This example sets an arbitrarily large value of `99`.) |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +Click **Save**. You will be prompted to set the initial file creation time to check for. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +Click **Save** to set the current time as the starting time and return to the **Scenario** view. |
| 54 | + |
| 55 | +Before adding the next **Module**, upload a PDF file to your watched folder. Then, run the scenario by clicking the **Run once** button. This will enable you to view and select the output fields from this module when configuring the next module. |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +Before calling pdfRest, any files detected during the first step must be made accessible. Click the **+** next to your first **Module** to add another **Google Drive** app, this time with the **Get a Share Link** action. |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +Use the same **Connection** setting from the previous module. |
| 64 | + |
| 65 | +In **File ID**, clicking the text field should reveal a context menu. Click `File ID` from the previous **Google Drive** **Module** to populate the field. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +Set **Role** to `Reader`, and set **Type** to `Anyone`. This will allow the next module to access new files detected by the first module. |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +Click **Save** to confirm settings and return to the **Scenario** overview. |
| 74 | + |
| 75 | +--- |
| 76 | +## Step 2: Upload from Google Drive to pdfRest |
| 77 | + |
| 78 | +The next step is to upload the input file using the [**/upload** API endpoint in pdfRest](https://docs.pdfrest.com/pdfrest-api-toolkit-cloud/api-reference-guide/#/upload). |
| 79 | + |
| 80 | +Click **+** to add a new **App**, then find the built-in **HTTP** **App**. (You may have to search for "http" first.) |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +From the **HTTP App**, select the **Make an API Key Auth request** action. |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +In **Credentials**, click **Add** to add your pdfRest API key. The API key must be placed `In the header` and named **Api-Key**. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +Click **Create**. This will ensure that the API key is added into the request header. |
| 93 | + |
| 94 | +Ensure that your keychain is selected in **Credentials**. Next, enter `https://api.pdfrest.com/upload` into the **URL** field. Set the HTTP request **Method** to `POST`. |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +Set **Body type** to `Multipart/form-data`. |
| 99 | + |
| 100 | +In **Fields**, add a new item. Set **Field type** on the new item to `text` and the **Key** to `url`. Clicking the **Value** field should reveal a context menu containing response items from **Google Drive**. Scroll down to find and select `webContentLink`. |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +Set **Parse response** to `Yes`. This will enable the following Module to read and use the value of the response obtained by this module. |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +Click **Save** to add the app to the **Scenario** and return to the **Scenario** view. |
| 109 | + |
| 110 | +With both **Apps** added, add a new file to your watched folder and then click **Run** once to run the **Scenario**. A green checkmark on all **Modules** means that the **Scenario** ran successfully. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +--- |
| 115 | +## Step 3: Compress PDF Files on Google Drive with pdfRest |
| 116 | + |
| 117 | +The next step is to process the newly uploaded PDFs using the pdfRest API. This will use the [**/compressed-pdf** API endpoint](https://docs.pdfrest.com/pdfrest-api-toolkit-cloud/api-reference-guide/#/compressed-pdf). |
| 118 | + |
| 119 | +Click **+** to add another **HTTP App** with the **Make an API Key Auth request** action. |
| 120 | + |
| 121 | +Set the **URL**to the endpoint of the pdfRest tool you wish to use, in this **Scenario** we are using `https://api.pdfrest.com/compressed-pdf` to optimize the size of the document. This example will use the [Compress PDF API Tool to optimize the file size of the document](https://pdfrest.com/apitools/compress-pdf/). |
| 122 | + |
| 123 | +Ensure that **Credentials** is set to the keychain you created earlier. Set **Method** to `POST`, and set **Body type** to `Multipart/form-data`. |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +To set the input file, create a **Body Parameter** named `id` with a **Field Type** of `Text`. Set its value to the `id` field retrieved from the previous **HTTP App**. |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +Add additional `Text` **Field Types** for any additional parameters in your request. For example, the Compress PDF API requires the `compression_level` parameter as shown below. |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +Further down, set **Parse response** to `Yes`. |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +Click **Save** to confirm settings. |
| 140 | + |
| 141 | +Run your scenario once more by uploading a file and clicking **Run once** to ensure that everything is working and to obtain the field names of the response from the **File Processing Module**. |
| 142 | + |
| 143 | +--- |
| 144 | +## Step 4: Send Compressed PDF Files to Google Drive |
| 145 | + |
| 146 | +To retrieve the newly compressed file, add a third **HTTP App**, this time with the **Get a file** action. |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | +In **URL**, set the value to the `outputUrl` from the previous **HTTP App's** response. |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | +Click **Save** to add this Module. Run the **Scenario** once more with a new file to ensure that all requests run successfully. |
| 156 | + |
| 157 | +From here, you may send the downloaded file to the location of your choice. A good example would be to use the **Upload a File** **Action** from the ** Google Drive** **App** to send the processed file to a specific Drive folder. |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | +Set **New Drive Location** and **New Folder Location** to indicate where to save the compressed file(s). |
| 162 | + |
| 163 | +In **File**, use the value returned from the **Get a file** action of the **HTTP App**. |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | +Click **Save** to confirm. |
| 168 | + |
| 169 | +Upload one or more files to the Google Drive folder and run the **Scenario** with **Run once**. If successful, all modules will display a green checkmark. |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | +Your processed file should now be available in your destination folder. |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | +Of course, you can customize the end step to pass pdfRest output files anywhere you need to send them for the next steps in their journey. |
| 179 | + |
| 180 | + |
| 181 | +If you have any trouble getting this set up or would like more information about how pdfRest can solve your PDF processing challenges, please [let us know](https://pdfrest.com/support/) how we can help! |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## Conclusion |
| 186 | + |
| 187 | +By following this guide, you've successfully created a powerful, automated workflow that integrates Make, Google Drive, pdfRest, and your documents. The pdfRest API Toolkit includes dozens of other endpoints for document signing, conversion, securing, and more - all of which can be integrated with Make and your document workflows. |
| 188 | + |
| 189 | +Now that you've mastered the basics, what will you build next? Get started by [signing up for a free pdfRest Starter account](https://pdfrest.com/getstarted/) and explore the full range of what's possible with the pdfRest API. |
0 commit comments