How to return JSON from Make.com to GT via API

I’m trying to write JSON to a text column in the GT using the HTTP module in Make.

Instead of the module parse it and send it to different columns I want to try and send the whole JSON back and then I use query JSON columns to extract what I need.

However I think i’m running into an issue where the Glide API is getting an ‘unexpected token’ which occurs at the start of the JSON i’m trying to pass. My guess is that it’s interpreting it as part of the JSON instead of a value string?

When I look at the request content on the HTTP module after the call the data looks like this:


"columnValues": {
        "BFEgI": "/{"response":true,"msg":"appointment created successfully","data":{"appointment":{"key":"a2762f50e1696e9833f68e8c009c366898e6d2d4","start_time":"2023-12-21T14:00Z","end_time":"2023-12-21T14:30Z","duration":30,"staff_key":"9ZiX6zYRYb6YjVwU361TdQsx5DmVDthF","service_key":"fc5dc4e4-9e54-4d6d-ba64-9c07dcd9ffac","customer_key":"c97b080ddf0f5dc43ebfdf56d4cc07be417737be1","cost":0.0,"currency":"QAR"}}}/"
      },

“BFEgI” is the column ID and the rest is what was sent as the value, which looks to be escaped at the beginning and end, does more work need to be done to get it where I need it?

Yes.
Double quotes are reserved characters in JSON, so if you want to send a JSON string that includes double-quotes, then every one of them needs to be escaped.

You would need something like the following:

 "columnValues": {
        "BFEgI": "{\"respone\":true,\"msg\":\"appointment created successfully\",\"data\":{\"appointment\":{\"key\":\"a2762f50e1696e9833f68e8c009c366898e6d2d4\",\"start_time\":\"2023-12-21T14:00Z\",\"end_time\":\"2023-12-21T14:30Z\",\"duration\":30,\"staff_key\":\"9ZiX6zYRYb6YjVwU361TdQsx5DmVDthF\",\"service_key\":\"fc5dc4e4-9e54-4d6d-ba64-9c07dcd9ffac\",\"customer_key\":\"c97b080ddf0f5dc43ebfdf56d4cc07be417737be1\",\"cost\":0.0,\"currency\":\"QAR\"}}}"
    }

I would recommend using the Create JSON module to prepare the JSON string.

2 Likes

The output of the HTTP module of the Call I made to the service returns something that looks just like that:

 "data": "{\"response\":true,\"msg\":\"appointment created successfully\",\"data\":{\"appointment\":{\"key\":\"a2762f50e1696e9833f68e8c009c366898e6d2d4\",\"start_time\":\"2023-12-21T14:00Z\",\"end_time\":\"2023-12-21T14:30Z\",\"duration\":30,\"staff_key\":\"9ZiX6zYRYb6YjVwU361TdQsx5DmVDthF\",\"service_key\":\"fc5dc4e4-9e54-4d6d-ba64-9c07dcd9ffac\",\"customer_key\":\"c97b080ddf0f5dc43ebfdf56d4cc07be417737be1\",\"cost\":0.0,\"currency\":\"QAR\"}}}",
        "fileSize": 397

So why then when mapping that ‘data’ variable to the HTTP module that posts to Glide they are removed?

Regarding the Create JSON module, can you point to any guidance on how to configure that?

I could get the module to create this:

[
    {
        "json": "{\"msg\":\"appointment created successfully\",\"data\":{\"appointment\":{\"key\":\"8c4d930d103c2c2c64395a15c280f6cfe91a6356\",\"cost\":0,\"currency\":\"QAR\",\"duration\":30,\"end_time\":\"2023-12-21T14:30Z\",\"staff_key\":\"9ZiX6zYRYb6YjVwU361TdQsx5DmVDthF\",\"start_time\":\"2023-12-21T14:00Z\",\"service_key\":\"fc5dc4e4-9e54-4d6d-ba64-9c07dcd9ffac\",\"customer_key\":\"c97b080ddf0f5dc43ebfdf56d4cc07be417737be1\"}}}"
    }
]

But still facing the same issue. Maybe it’s due to the fact there are quotation marks still wrapping the key-value elements?

  • Add a Create JSON module after your HTTP module. The JSON module will ask you to select a Data Structure. Use the Generate option and paste the JSON from the curl Add example you get from Glide.
  • Save that and add a mutation, and select the output of the HTTP module for the BFEgI column value.
  • Then use the output of the JSON module for the Data section of your subsequent HTTP module.
2 Likes

It looks like I have step 1 and 3 down. But step 2 I cannot find ‘mutation’ inside the create JSON module. I have just input the variables from the parsed HTTP output:

No, that’s not right. The Data Structure you need to create should reflect what Glide expects.
So when generating the Data Structure, you need to copy/paste the JSON that Glide gives you. It should look something like this:

{
  "appID": "g48SQKxe6O.....",
  "mutations": [
    {
      "kind": "add-row-to-table",
      "tableName": "native-table-bb6a051a-862f-.......",
      "columnValues": {
        "nFhNw": "Owner",
        "WjVBD": "DateTime",
        "ulyfC": "UserEmail",
        "5lYMU": "UserName",
        "w7iQn": "Action",
        "W1bs3": "Resource",
        "cL7uj": "ResourceID",
        "OCNk1": "ResourceOwnerName",
        "UHibj": "ResourceOwnerEmail",
        "Yvo5j": "Comment"
      }
    }
  ]
}
2 Likes

That makes sense! I’ve got it thanks!

1 Like

How would I configure the create JSON module to output only the value that I want and not the whole payload that Glide expects, for the purposes of mapping it to the new Glide Make.com module?

To be honest, I wouldn’t use the Glide module in this case. I would just use a HTTP module to send the API call to Glide.

1 Like

Fair enough, thanks for your help!

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