invokeUrl in Zoho QEngine | Zoho QEngine Help

invokeUrl task

 1. Overview 

In modern testing, web interactions rarely occur in isolation; tests often need to interact with APIs, manipulate data, or trigger other systems to reflect real-world workflows. The invoke Url task in Zoho QEngine bridges this gap, letting you integrate API calls and external operations directly into their web test cases. It lets you access web resources, communicate with other Zoho services via their APIs, or work with third-party services securely.

Zoho QEngine’s connections provide a safe and reliable mechanism for authentication and authorization, ensuring every API call is executed securely. With Invoke URL, you can orchestrate complex sequences, automate backend and frontend workflows, and execute multi-system scenarios, all from a single testing environment. This enables end-to-end automation and ensures tests mirror real-world use cases efficiently and reliably.

Notes

Notes:

  • Public web resources do not require authentication, so you can call them directly.
  • This task will throw "socket timeout error" if the web resource/API takes more than 60 seconds to respond. This means that the task will be terminated, and you need to wait for a few moments before trying again.
  • Any API that is private, whether it’s a Zoho service or third-party, must use a Connection to handle authentication securely.
  • The default connection timeout will happen in 10 seconds, and the connection request timeout in 5 seconds.
  • This task can download files up to 5 MB. 

1.1 Syntax 

  1. <response> = invokeUrl 
  2. url: <url_value>
  3. type: <type_value>
  4. headers: {<headers_value>}
  5. parameters: {<parameters_value>}
  6. connection: "<connection_name>"
  7. ];
Parameter
Description
<response>
The variable that stores the response of the invoke URL call. 
<url_value>
The endpoint URL to which the request is sent. Can be a web resource, another Zoho service API, or a third-party API.
<type_value>

The HTTP method for the request.

Supported values:

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

<headers_value>
(optional)
Contains HTTP headers to be sent with the request. Headers let you define authentication details, content preferences, and request conditions. 
<parameters_value>
(optional)

The data sent in the request body for POST/PUT/PATCH requests.

If you pass a plain text value, it is treated as Raw, and the body is sent exactly as defined. If you pass key–value pairs, it is automatically treated as x-www-form-urlencoded, where both keys and values are URL-encoded (for example, a space becomes %20). This format resembles a query string but is placed in the request body instead of the URL.
<connection_name>
(optional)
The connection link name of the required service.

To use this, you must first create a connection in Zoho QEngine with the necessary authentication and request details. Once created, the connection is identified by its link name, which you reference here to authorize the invokeUrl call. For detailed steps on creating and managing connections, see Connections

2. Using invoke Url in Zoho QEngine 

Use Case: Pull User Data to Automate Dependent Test Steps

In this example, we'll fetch the list of users from the Zoho QEngine portal named Zylker. The QEngine API call is made within the script to pull live portal data that can drive subsequent test actions. For example, fetching the latest user list before assigning test roles, validating user availability, or applying conditions based on user details. By retrieving this data through the API, your test scripts stay adaptive and always reflect the current state of the portal.

To do this, we first create a connection in QEngine, which securely links the portal to its API. The connection provides a link name, which we use in our GET request to identify and authenticate the portal when fetching the user list.

  1. response = invokeUrl
  2. [
  3. url:"https://qengine.zoho.com/api/v1/zylker/myusers"
  4. type: GET
  5. connection:"qengine"
  6. ];

  7. info(response); 
where:

response
Stores the API response, which contains the user details of the portal.
QEngine’s REST API endpoint for fetching users in the Zylker portal. Learn more
GET
The HTTP method used to retrieve the records.
"qengine"
The connection link name authorized with QEngine.
  

3. Examples

Example 1: Automating Client Record Creation

This script demonstrates how to create a new client record in Zoho Recruit using its API. While users could manually add a client via the Zoho Recruit UI, doing so via a script is essential when you need to automate repetitive tasks, create multiple records in bulk, or integrate client creation into a larger test flow. To do this, you first establish a connection to Zoho Recruit, which provides the authentication required to invoke the API. Using this connection, the script sends the client details, making it easier to automate record creation. 

  1. client_payload = {
  2.     "data": [{
  3.         "Client_Name": "Zylker Group",
  4.         "Billing_City": "Keralabank",
  5.         "Billing_State": "Kerala",
  6.         "Billing_Country": "India",
  7.         "Contact_Number": "74*******5",
  8.         "Industry": "Television",
  9.         "Source": "Meetup",
  10.         "Website": "https://www.zylkergroup.com/about-us.html",
  11.         "Territories": "T1"
  12.     }]
  13. };

  14. // 2. Call the API via invokeurl
  15. response = invokeurl
  16. [
  17.     url: "https://recruit.zoho.com/recruit/v2/Clients"
  18.     type: POST
  19.     parameters: client_payload.toString()
  20.     connection: "recruit"
  21. ];
  22. // 3. Log the response
  23. if(response.isFile()){
  24. info(response.getFileContent());
  25. }else{
  26. info(response.isFile());
  27. }

where,
     
client_payload
The data you are sending to Zoho Recruit API. It contains the values for the new record and must be formatted according to the API documentation to ensure the request is processed correctly.
This URL defines where the data is sent and ensures that your API call reaches the clients module in Zoho Recruit.
POST
HTTP request method specifying the action.
client_payload.toString()
The data sent in the request body. The toString() is a built-in function that converts the JSON object into a string so it can be sent in the API request. 
"recruit"
The name of the connection.

  1. Scripts
  2. Test Cases

5. What's next

Next step
Next step
You’ve learned how to use the invokeUrl task in test cases to make HTTP requests, fetch data, and integrate APIs securely in Zoho QEngine.