[Make.com] Uploading FILES to Noloco Via the API - blueprint example

This took me a long time to figure out so thought I’d share with the community here for folks who use Make a lot.

Noloco has a great file storage system, but accessing it via API is a bit more technical than most folks are familiar with when it comes to no code… so here’s the approach I’ve taken in make.com. I’ve attached a blueprint you can modify for your own projects.

Step 1: Set the values in the “set value” module…

:: ID of Parent Resource = the id of the datatype (airtable table for example) you want the file to be attached to

:: name of ATTACHMENT field = the API name of the field where the attachment/files are stored in noloco, in my example it’s named ‘preview’

:: parentResourceName = the API name of the parent datatype… the table in noloco’s name.

Step 2: A module in make to download a file

In this case i’m downloading an image… but should work with any file type that Noloco supports. Often you’ll get files via various means in Make, you’ll just want to make sure it’s returned as “binary data” (whatever that means)… you need to get the raw file data somehow in make - i’m just using the HTTP/Get a File module here.

Step 3: Set up an HTTP/Get request module in Make to load the FILE into noloco AND attach it to your parent table “attachment field”…


first add your portal details as labled…

All the variables we set up in the “Set Values” module should populate correctly in the “operations” area…

The file itself is passed via the following form data:

For the 3 people out there who find this years later while playing with make/noloco - I hope this helps hahah

Shout out to Alex from Sonorus’s video which helped a ton for this:

BLUEPRINT - just copy/paste this into a scenario and modify the values:

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 1,
                    "module": "util:SetVariables",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "variables": [
                            {
                                "name": "id of parent resource",
                                "value": "29"
                            },
                            {
                                "name": "name of ATTACHMENT field",
                                "value": "preview"
                            },
                            {
                                "name": "parentResourceName",
                                "value": "Instructlet"
                            }
                        ],
                        "scope": "roundtrip"
                    },
                    "metadata": {
                        "designer": {
                            "x": 291,
                            "y": 1,
                            "name": "Set Values"
                        },
                        "restore": {
                            "expect": {
                                "variables": {
                                    "items": [
                                        null,
                                        null,
                                        null
                                    ]
                                },
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "variables",
                                "type": "array",
                                "label": "Variables",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Variable name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Variable value",
                                        "type": "any"
                                    }
                                ]
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            }
                        ],
                        "interface": [
                            {
                                "name": "id of parent resource",
                                "label": "id of parent resource",
                                "type": "any"
                            },
                            {
                                "name": "name of ATTACHMENT field",
                                "label": "name of ATTACHMENT field",
                                "type": "any"
                            },
                            {
                                "name": "parentResourceName",
                                "label": "parentResourceName",
                                "type": "any"
                            }
                        ]
                    }
                },
                {
                    "id": 2,
                    "module": "http:ActionGetFile",
                    "version": 3,
                    "parameters": {
                        "handleErrors": false
                    },
                    "mapper": {
                        "url": "https://europe1.discourse-cdn.com/flex005/uploads/noloco/original/1X/192fdcad301f595235c504975b31cb72ada7f5c2.png",
                        "serializeUrl": false,
                        "method": "get",
                        "shareCookies": false
                    },
                    "metadata": {
                        "designer": {
                            "x": 601,
                            "y": 8,
                            "name": "Download File"
                        },
                        "restore": {},
                        "parameters": [
                            {
                                "name": "handleErrors",
                                "type": "boolean",
                                "label": "Evaluate all states as errors (except for 2xx and 3xx )",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "url",
                                "type": "url",
                                "label": "URL",
                                "required": true
                            },
                            {
                                "name": "serializeUrl",
                                "type": "boolean",
                                "label": "Serialize URL",
                                "required": true
                            },
                            {
                                "name": "method",
                                "type": "hidden",
                                "label": "Method"
                            },
                            {
                                "name": "shareCookies",
                                "type": "boolean",
                                "label": "Share cookies with other HTTP modules",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 3,
                    "module": "http:ActionSendData",
                    "version": 3,
                    "parameters": {
                        "handleErrors": false,
                        "useNewZLibDeCompress": true
                    },
                    "mapper": {
                        "url": "https://api.portals.noloco.io/data/YOURPORTALURL",
                        "serializeUrl": false,
                        "method": "post",
                        "headers": [
                            {
                                "name": "Authorization",
                                "value": "Bearer YOUR_API_KEY_HERE"
                            }
                        ],
                        "qs": [],
                        "bodyType": "multipart_form_data",
                        "parseResponse": true,
                        "authUser": "",
                        "authPass": "",
                        "timeout": "",
                        "shareCookies": false,
                        "ca": "",
                        "rejectUnauthorized": true,
                        "followRedirect": true,
                        "useQuerystring": false,
                        "gzip": true,
                        "useMtls": false,
                        "formDataFields": [
                            {
                                "fieldType": "text",
                                "key": "operations",
                                "value": "{\n  \"operationName\": \"update{{1.parentResourceName}}\",\n  \"variables\": {\n    \"id\": \"{{1.`id of parent resource`}}\",\n    \"{{1.`name of ATTACHMENT field`}}\": [null]\n  },\n  \"query\": \"mutation update{{1.parentResourceName}}($id: ID!, ${{1.`name of ATTACHMENT field`}}: [Upload!], ${{1.`name of ATTACHMENT field`}}Id: [ID!]) { update{{1.parentResourceName}}(id: $id, {{1.`name of ATTACHMENT field`}}: ${{1.`name of ATTACHMENT field`}}, {{1.`name of ATTACHMENT field`}}Id: ${{1.`name of ATTACHMENT field`}}Id) { id uuid {{1.`name of ATTACHMENT field`}} { edges { node { id uuid fileType mimetype url name __typename } __typename } __typename } } }\"\n}"
                            },
                            {
                                "fieldType": "file",
                                "key": "f1",
                                "data": "{{2.data}}",
                                "fileName": "{{2.fileName}}"
                            },
                            {
                                "fieldType": "text",
                                "key": "map",
                                "value": "{\"f1\":[\"variables.{{1.`name of ATTACHMENT field`}}.0\"]}"
                            }
                        ],
                        "followAllRedirects": false
                    },
                    "metadata": {
                        "designer": {
                            "x": 953,
                            "y": 8,
                            "name": "Upload File to Noloco"
                        },
                        "restore": {
                            "expect": {
                                "method": {
                                    "mode": "chose",
                                    "label": "POST"
                                },
                                "headers": {
                                    "mode": "chose",
                                    "items": [
                                        {
                                            "name": {
                                                "collapsed": true
                                            }
                                        }
                                    ]
                                },
                                "qs": {
                                    "mode": "chose"
                                },
                                "bodyType": {
                                    "label": "Multipart/form-data"
                                },
                                "formDataFields": {
                                    "mode": "chose",
                                    "items": [
                                        {
                                            "fieldType": {
                                                "mode": "chose",
                                                "label": "Text"
                                            }
                                        },
                                        {
                                            "fieldType": {
                                                "mode": "chose",
                                                "label": "File"
                                            }
                                        },
                                        {
                                            "fieldType": {
                                                "mode": "chose",
                                                "label": "Text"
                                            }
                                        }
                                    ]
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "handleErrors",
                                "type": "boolean",
                                "label": "Evaluate all states as errors (except for 2xx and 3xx )",
                                "required": true
                            },
                            {
                                "name": "useNewZLibDeCompress",
                                "type": "hidden"
                            }
                        ],
                        "expect": [
                            {
                                "name": "url",
                                "type": "url",
                                "label": "URL",
                                "required": true
                            },
                            {
                                "name": "serializeUrl",
                                "type": "boolean",
                                "label": "Serialize URL",
                                "required": true
                            },
                            {
                                "name": "method",
                                "type": "select",
                                "label": "Method",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "get",
                                        "head",
                                        "post",
                                        "put",
                                        "patch",
                                        "delete",
                                        "options"
                                    ]
                                }
                            },
                            {
                                "name": "headers",
                                "type": "array",
                                "label": "Headers",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Value",
                                        "type": "text"
                                    }
                                ]
                            },
                            {
                                "name": "qs",
                                "type": "array",
                                "label": "Query String",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Value",
                                        "type": "text"
                                    }
                                ]
                            },
                            {
                                "name": "bodyType",
                                "type": "select",
                                "label": "Body type",
                                "validate": {
                                    "enum": [
                                        "raw",
                                        "x_www_form_urlencoded",
                                        "multipart_form_data"
                                    ]
                                }
                            },
                            {
                                "name": "parseResponse",
                                "type": "boolean",
                                "label": "Parse response",
                                "required": true
                            },
                            {
                                "name": "authUser",
                                "type": "text",
                                "label": "User name"
                            },
                            {
                                "name": "authPass",
                                "type": "password",
                                "label": "Password"
                            },
                            {
                                "name": "timeout",
                                "type": "uinteger",
                                "label": "Timeout",
                                "validate": {
                                    "max": 300,
                                    "min": 1
                                }
                            },
                            {
                                "name": "shareCookies",
                                "type": "boolean",
                                "label": "Share cookies with other HTTP modules",
                                "required": true
                            },
                            {
                                "name": "ca",
                                "type": "cert",
                                "label": "Self-signed certificate"
                            },
                            {
                                "name": "rejectUnauthorized",
                                "type": "boolean",
                                "label": "Reject connections that are using unverified (self-signed) certificates",
                                "required": true
                            },
                            {
                                "name": "followRedirect",
                                "type": "boolean",
                                "label": "Follow redirect",
                                "required": true
                            },
                            {
                                "name": "useQuerystring",
                                "type": "boolean",
                                "label": "Disable serialization of multiple same query string keys as arrays",
                                "required": true
                            },
                            {
                                "name": "gzip",
                                "type": "boolean",
                                "label": "Request compressed content",
                                "required": true
                            },
                            {
                                "name": "useMtls",
                                "type": "boolean",
                                "label": "Use Mutual TLS",
                                "required": true
                            },
                            {
                                "name": "formDataFields",
                                "type": "array",
                                "label": "Fields",
                                "spec": [
                                    {
                                        "name": "fieldType",
                                        "label": "Field type",
                                        "type": "select",
                                        "required": true,
                                        "options": [
                                            {
                                                "value": "text",
                                                "label": "Text",
                                                "nested": [
                                                    {
                                                        "name": "key",
                                                        "label": "Key",
                                                        "type": "text",
                                                        "required": true
                                                    },
                                                    {
                                                        "name": "value",
                                                        "label": "Value",
                                                        "type": "text"
                                                    }
                                                ]
                                            },
                                            {
                                                "value": "file",
                                                "label": "File",
                                                "nested": [
                                                    {
                                                        "name": "key",
                                                        "label": "Key",
                                                        "type": "text",
                                                        "required": true
                                                    },
                                                    {
                                                        "name": "data",
                                                        "label": "Data",
                                                        "type": "buffer",
                                                        "semantic": "file:data"
                                                    },
                                                    {
                                                        "name": "fileName",
                                                        "label": "File name",
                                                        "help": "File name, including the suffix, e.g. invoice, xml",
                                                        "type": "filename",
                                                        "semantic": "file:name"
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "name": "followAllRedirects",
                                "type": "boolean",
                                "label": "Follow all redirect",
                                "required": true
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}
4 Likes

Thank you so much for taking the time to share this! I put this to work tonight!! Super helpful! I did have to take off the subflows wrap to get the blueprint to import. Also, I think it may help to note that the ‘parentResourceName’ can be found in the url of your table when viewing it under ‘Data’, I had to capitalize the first letter. Saved me days of trying to figure it out though, thanks again!! :smiley:

1 Like

Hi,
Thank you ! I try but “operationName” doesn’t seem to be recognized

{
"operationName": "updateProjectCollection",
"variables": {
"id": "82",
"factureVenteId": [null]
},
  "query": "mutation updateProjectCollection($id: ID!, $factureVente: [Upload!], $factureVenteId: [ID!]) { updateProjectCollection(id: $id, factureVenteId : $factureVenteId, factureVenteId: $factureVenteId) { id uuid FactureVenteId { edges { node { id uuid fileType mimetype url name __typename } __typename } __typename }}"

I have this error :

{
    "errors": [
        {
            "message": "Multipart form field \"operations\" must be a valid JSON string"
        }
    ]
}

Thank you per advance !

Thank you very much for this, I couldn’t do it without this help. Was able to create new records in a dedicated Reports table with this.

mutation createNewReport(
  $reportName: String!,
  $createdById: ID!,
  $reportFile: Upload
) {
  createReports(
    reportName: $reportName,
    createdById: $createdById, 
    reportFile: $reportFile
  ) {
    id
    reportName
    createdBy { 
      id
      
    }
    reportFile {
      id
    }
  }
}

1 Like

Great stuff, took a bit of tweaking to get it to work with an attachment field that only accepts a single file, but saved me a lot of time! Thank you.

2 Likes