Zoho Deluge invokeurl Returns .json Filename? Fix It

Why does the Zoho Deluge invokeurl task return a timestamped .json filename instead of the expected data, and how can it be parsed and written to Zoho Sheet?

Zoho Deluge invokeurl Returns a .json Filename: Get the JSON Body

Zoho Deluge invokeurl Returns Only a ".json" Filename? How to Get the Real JSON Body

You call an API from Deluge and get HTTP 200, but responseText contains something like 1712345678901.json instead of data. The same request in PowerShell or curl returns a normal JSON body. This is a known pattern, and it’s often fixable in minutes.

Originally published at Zoho Survey invokeurl returns ".json" filename (responseText) instead of inline JSON when generating unique URL from trigger function.

In this guide, you’ll learn how to:

  • Tell whether Deluge is treating your response as a file
  • Fix it with headers, then convert the file to text and parse it
  • Handle APIs that return a download link instead of data
  • Use a proxy or Zoho Flow when Deluge won’t cooperate
  • Write the parsed values to Zoho Sheet

Why you see a filename instead of JSON

The filename probably isn’t the API’s real response. Deluge is most likely treating the response as a file. When invokeurl receives a file-type response, it wraps it in a File object. Printing that object shows a generated name, often based on a timestamp, instead of the contents.

Zoho’s Deluge documentation lists the possible response types as key-value, file, text, and list. A response is typically handled as a file when the API sends:

  • A Content-Disposition: attachment header
  • A binary or non-standard Content-Type, such as application/octet-stream

PowerShell and curl print the raw body, so they hide this difference. Deluge also sends different default headers, which may lead the server to respond differently.

A less likely cause is that the API really does return a file reference or download link that needs a second call. We haven’t verified the behavior of the specific API in the original question. Step 1 below will confirm what’s happening in your case.

Solution A: Inspect the response, then convert the file to text

This is the fastest fix and works in most cases.

Step 1: Diagnose with detailed: true

Adding detailed: true makes invokeurl return the status code, response headers, and body together.

resp = invokeurl
[
    url :"<API_URL>"
    type :POST
    parameters: payload.toString()
    headers: {"Authorization":"Bearer " + token, "Accept":"application/json", "Content-Type":"application/json"}
    detailed: true
];
info resp.get("responseCode");
info resp.get("responseHeader");   // check Content-Type / Content-Disposition
info resp.get("responseText");

Compare responseHeader with the output of curl -i for the same call. If Content-Type isn’t application/json, or a Content-Disposition header is present, that confirms the file-handling theory.

Step 2: Force JSON negotiation

Add Accept: application/json and an explicit Content-Type. Copy any other headers that work in curl or PowerShell, then run the request again. This often fixes the problem.

Step 3: If it’s still a file, read it as text and parse it

If the file contains JSON text, convert it to a string and then to a map.

raw = resp.get("responseText");      // or the non-detailed response itself
content = raw.toString();            // should return the file contents
data = content.toMap();              // JSON string -> map
uniqueUrl = data.get("unique_url");
shortUrl  = data.get("short_unique_url");
info uniqueUrl;

A few tips:

  • The JSON may be nested, for example under "data" or "result". Run info data; first and adjust your get() path.
  • Some Deluge environments also support getContent() on file objects. Use it if toString() returns the filename again.
  • A file is parseable only if its bytes are JSON text. Binary content won’t convert.
  • Behavior can vary by Deluge context, so test with info before building on it.

Sometimes the first response isn’t the data. If detailed: true shows a Location header or a JSON pointer, or the docs describe an asynchronous, "export", or "download" flow, make a second invokeurl GET request to that URL. Use the same authentication and read the result as in Solution A.

For Zoho Survey, check the Zoho Survey API reference for the exact endpoint. Unique and short survey links are tied to distribution collectors, so confirm which endpoint exposes them in your account and data center. For OAuth setup, see Zoho’s OAuth documentation.

Solution C: Put a thin proxy in front of the API

If Deluge can’t read the body, add a small layer to handle it. A Zoho Catalyst function, AWS Lambda, Azure Function, or Cloudflare Worker can:

  1. Call the API exactly as your working curl or PowerShell request does.
  2. Return Content-Type: application/json with only the fields you need, such as unique_url and short_unique_url.

Deluge then calls your proxy and receives clean JSON. This adds hosting and authentication setup. In return, it removes content-type ambiguity and keeps secrets out of your Deluge code. See the Catalyst documentation to get started.

Solution D: Move the logic into Zoho Flow

If your trigger starts from a survey response, you may not need to hand-code everything in Deluge. In Zoho Flow, you can build the following:

  1. A trigger for a new survey response.
  2. A custom function (Deluge) or a webhook/API action that calls the API.
  3. A Zoho Sheet "Add row" action that maps the parsed fields.

Flow’s built-in HTTP and webhook actions parse JSON for you, which may avoid the file-handling issue. Custom functions in Flow have their own output rules, which we cover in mastering Zoho Flow custom function outputs.

If you prefer a visual builder outside Zoho, Make.com can also handle the API call and JSON parsing.

If you collect responses in the first place with Zoho Survey, pairing it with Flow keeps the whole pipeline inside the Zoho ecosystem.

Solution E: Write the results to Zoho Sheet

Once you have uniqueUrl and shortUrl, add them to a worksheet using the Zoho Sheet API v2. Use a Zoho OAuth connection with the ZohoSheet.dataAPI.UPDATE scope.

records = List();
rec = Map();
rec.put("Unique URL", uniqueUrl);
rec.put("Short URL", shortUrl);
records.add(rec);

params = Map();
params.put("method", "worksheet.records.add");
params.put("worksheet_name", "Sheet1");
params.put("header_row", 1);
params.put("json_data", records.toString());

r = invokeurl
[
    url :"https://sheet.zoho.com/api/v2/<WORKBOOK_RESOURCE_ID>"
    type :POST
    parameters: params
    connection:"<your_zohosheet_connection>"
];
info r;

The worksheet.records.add method appends records after the last used row. Column headers must match the keys in json_data. Confirm the exact parameters in the Zoho Sheet API v2 documentation.

  1. Run Solution A, Steps 1 and 2. Use detailed: true and set Accept: application/json. This takes about 10 minutes and may fix the issue outright.
  2. If it’s still a file, apply Solution A, Step 3. If the API gives you a second URL, use Solution B instead.
  3. If neither works, use Solution C (proxy) as the durable fix.
  4. Add Solution E to write the data to Zoho Sheet. Include error handling for a non-200 responseCode and missing keys.

For more Deluge debugging tips, see mastering Deluge troubleshooting. For another invokeurl pattern that parses an API response, see getting geolocation data from an IP address in Zoho Creator.

Caveats

  • Behavior depends on the API and context. We couldn’t verify the exact endpoint behavior or file-to-text handling for every setup. Treat .toString() and .toMap() as steps to test, not guaranteed behavior.
  • Where your Deluge runs matters. Zoho Survey doesn’t clearly offer a native Deluge trigger. Deluge usually runs through Zoho Flow, Zoho Creator, Zoho CRM, or another Zoho service. That choice affects which connection methods are available for Zoho Sheet.
  • Keep tokens in Connections, not in script text.

Questions that help narrow it down

If you’re still stuck, gather these details first:

  • Where does your Deluge code run (a Flow custom function, Creator, or a Survey webhook)?
  • Which exact API endpoint and base URL are you calling?
  • What do Content-Type and Content-Disposition look like in curl -i?
  • What does info resp.get("responseHeader") show in Deluge?

Key takeaways

  • A timestamp .json value in responseText usually means Deluge wrapped the response in a File object.
  • Use detailed: true to inspect the status code, headers, and body before changing anything.
  • Setting Accept: application/json and matching your working curl headers often fixes the issue.
  • If it’s still a file, convert it with toString(), then parse it with toMap().
  • If all else fails, a proxy or Zoho Flow gives you clean, predictable JSON.

Need a hand with your Deluge integration?

Stubborn API responses, OAuth connections, and Flow-to-Sheet pipelines are routine work for our team. If you’d like an expert to review your setup, book a consultation. You can also browse our Zoho services, explore more tutorials on the Creator Scripts blog, or reach out through our support portal.